chiark / gitweb /
check output from yarrg is as we expect
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 5 Sep 2010 12:39:16 +0000 (13:39 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 5 Sep 2010 12:39:16 +0000 (13:39 +0100)
src/com/tedpearson/ypp/market/MarketUploader.java

index bac5522..6cf889a 100644 (file)
@@ -1067,11 +1067,12 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
        http.setParameter("data", "deduped.tsv.gz", file, "application/octet-stream");
        InputStream in = post_for_yarrg(http);
        if (in == null) return false;
-       BufferedReader br = new BufferedReader(new InputStreamReader(in));
-       String yarrgresult; 
-       while((yarrgresult = br.readLine()) != null) {
-           if (dtxt!=null) dtxt.println(yarrgresult);
+       String output = readstreamstring(in);
+       if (!output.startsWith("OK")) {
+           error("<html><h1>Unexpected output from YARRG server</h1>\n" + output);
+           return false;
        }
+       if (dtxt!=null) dtxt.println(output);
        return true;
     }