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 bac55220cf9658d6538a907bc754f30214a5d6c2..6cf889a660f9d0aef519c02786f832cc560dfe82 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;
     }