dtxt.println("progress "+(now - startTime)+"ms "+s);
}
+ private void debug_write_stringdata(String what, String data) throws FileNotFoundException,IOException {
+ if (dtxt==null) return;
+ PrintStream strm = new PrintStream(new File("jarrg-debug-"+what));
+ strm.print(data);
+ strm.close();
+ }
+
private void progressNote(ProgressMonitor pm, String s) {
String arb = null;
if (arbitrageResult != null)
}
private void error_html(String msg, String html) {
- //System.err.println("===" + html + "===");
-
Pattern body = Pattern.compile("<body>(.*)</body>", Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
Matcher m = body.matcher(html);
if (m.find()) {
progressNote(pm, "Yarrg: Uploading");
progresslog("yarrg upload...");
+ debug_write_stringdata("yarrg-deduped.tsv", yarrgdata);
+
doneyarrg = runYarrg(yarrgts, oceanName, islandName, yarrgdata);
progresslog("yarrg done.");
}
*/
private boolean finishUpload(InputStream in) throws IOException {
String html = readstreamstring(in);
- // if (dtxt!=null) dtxt.println(html);
+ debug_write_stringdata("pctb-initial.html", html);
Matcher m;
Pattern params = Pattern.compile("(?s)<input type=\"hidden\" name=\"action\" value=\"setisland\" />.+?<input type=\"hidden\" name=\"forcereload\" value=\"([^\"]+)\" />.+?<input type=\"hidden\" name=\"filename\" value=\"([^\"]+)\" />");
URL get = new URL(PCTB_HOST_URL + "upload.php?action=setisland&ocean=" + oceanNum + "&island="
+ islandNum + "&forcereload=" + forceReload + "&filename=" + filename);
String complete = readstreamstring(get.openStream());
+ debug_write_stringdata("pctb-final.html", complete);
Pattern done = Pattern.compile("Your data has been integrated into the database. Thank you!");
m = done.matcher(complete);
if(m.find()) {
- if (dtxt!=null) dtxt.println("FILE upload successful!!!");
return true;
} else {
error_html("Something was wrong with the final upload parameters!", complete);
error("<html><h1>Unexpected output from YARRG server</h1>\n" + output);
return false;
}
- if (dtxt!=null) dtxt.println(output);
+ debug_write_stringdata("yarrg-result.txt", output);
return true;
}