chiark / gitweb /
replace almost all writes to yohoho log with writes to our debug log
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 5 Sep 2010 11:52:55 +0000 (12:52 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 5 Sep 2010 11:52:55 +0000 (12:52 +0100)
src/com/tedpearson/ypp/market/MarketUploader.java

index a7a90c8..1b1382e 100644 (file)
@@ -92,8 +92,9 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
        }
 
         private void progresslog(String s) {
+           if (dtxt == null) return;
            long now = new Date().getTime();
-           System.out.println("progress "+(now - startTime)+"ms "+s);
+           dtxt.println("progress "+(now - startTime)+"ms "+s);
        }
 
         private void progressNote(ProgressMonitor pm, String s) {
@@ -395,7 +396,7 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
                        html = m.replaceAll(" ");
                }
                String whole_msg = "<html><h1>Error</h1>"+msg+"<h1>PCTB Server said:</h1><blockquote>"+html+"</blockquote>";
-               System.err.println("###" + whole_msg + "###");
+               if (dtxt!=null) dtxt.println("###" + whole_msg + "###");
 
                JOptionPane.showMessageDialog(frame,whole_msg,"Error",JOptionPane.ERROR_MESSAGE);
        }
@@ -629,7 +630,7 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
        private Accessible descendNodes(Accessible parent, int[] path) {
                for(int i=0;i<path.length;i++) {
                        if (null == (parent = descend(parent, path[i]))) return null;
-                       // System.out.println(parent.getClass());
+                       //System.out.println(parent.getClass());
                }
                return parent;
        }
@@ -791,7 +792,7 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
                                        buySellCount[1]++;
                                }
                        } catch(IllegalArgumentException e) {
-                               System.err.println("Error: Unsupported Commodity \"" + offer.get(0) + "\"");
+                               if (dtxt!=null) dtxt.println("Error: Unsupported Commodity \"" + offer.get(0) + "\"");
                        }
                }
                if (buySellCount[0]==0 && buySellCount[1]==0) {
@@ -996,7 +997,7 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
                Pattern done = Pattern.compile("Your data has been integrated into the database. Thank you!");
                m = done.matcher(complete);
                if(m.find()) {
-                       System.out.println("FILE upload successful!!!");
+                       if (dtxt!=null) dtxt.println("FILE upload successful!!!");
                        return true;
                } else {
                        error_html("Something was wrong with the final upload parameters!", complete);
@@ -1046,7 +1047,7 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
        BufferedReader br = new BufferedReader(new InputStreamReader(in));
        String yarrgresult; 
        while((yarrgresult = br.readLine()) != null) {
-           System.out.println(yarrgresult);
+           if (dtxt!=null) dtxt.println(yarrgresult);
        }
        return true;
     }