From b1b517d0db9bcb15127dc1415238bfe1a9366b50 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 5 Sep 2010 14:28:02 +0100 Subject: [PATCH] debug write out deduped.tsv.gz not deduped.tsv --- .../tedpearson/ypp/market/MarketUploader.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/com/tedpearson/ypp/market/MarketUploader.java b/src/com/tedpearson/ypp/market/MarketUploader.java index 5fb927a..90a920a 100644 --- a/src/com/tedpearson/ypp/market/MarketUploader.java +++ b/src/com/tedpearson/ypp/market/MarketUploader.java @@ -105,6 +105,13 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis strm.close(); } + private void debug_write_bytes(String what, byte[] data) throws FileNotFoundException,IOException { + if (dtxt==null) return; + FileOutputStream strm = new FileOutputStream(new File("jarrg-debug-"+what)); + strm.write(data); + strm.close(); + } + private void progressNote(ProgressMonitor pm, String s) { String arb = null; if (arbitrageResult != null) @@ -537,8 +544,6 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis progressNote(pm, "Yarrg: Uploading"); progresslog("yarrg upload..."); - debug_write_stringdata("yarrg-deduped.tsv", yarrgdata); - doneyarrg = runYarrg(yarrgts, oceanName, islandName, yarrgdata); progresslog("yarrg done."); } @@ -586,11 +591,7 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis progresslog("pctb send..."); byte[] ba = outStream.toByteArray(); - if (dtxt!=null) { - FileOutputStream dbgdata = new FileOutputStream(new File("jarrg-debug-pctb-marketdata.gz")); - dbgdata.write(ba); - dbgdata.close(); - } + debug_write_bytes("pctb-marketdata.gz", ba); InputStream in = sendInitialData(new ByteArrayInputStream(ba)); progresslog("pctb sent."); @@ -1055,7 +1056,9 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis BufferedOutputStream bufos = new BufferedOutputStream(new GZIPOutputStream(bos)); bufos.write(yarrgdata.getBytes() ); bufos.close(); - ByteArrayInputStream file = new ByteArrayInputStream(bos.toByteArray()); + byte[] compressed = bos.toByteArray(); + debug_write_bytes("yarrg-deduped.tsv.gz", compressed); + ByteArrayInputStream file = new ByteArrayInputStream(compressed); ClientHttpRequest http = new ClientHttpRequest (YARRG_URL); http.setParameter("clientname", YARRG_CLIENTNAME); -- 2.30.2