Between Tuesday August 20th, 5:00pm and Thursday August 22nd, 8:00am git.uwaterloo.ca will be down for an upgrade to version 10.8.7.

5c1ece66 by Amin Bandali

Print human-readable errors

1 parent d5e6d4eb
......@@ -35,6 +35,7 @@
import java.util.concurrent.atomic.AtomicInteger;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
......@@ -43,7 +44,7 @@
@Command(showDefaultValues = true)
public abstract class CatalystCommand {
protected transient Result r;
protected transient Gson gson;
protected transient Gson gson, gsonPretty;
protected transient AtomicInteger errorCount;
protected transient Writer wtxt, wjson, ejson;
protected transient PrintWriter ptxt;
......@@ -96,6 +97,7 @@ protected void initialize(Path outputTxtFile, Path outputJsonFile, Path errorsJs
r.options = this;
r.results = new ArrayList<CorpusResult>();
gson = new Gson();
gsonPretty = new GsonBuilder().setPrettyPrinting().create();
errorCount = new AtomicInteger();
wtxt = setupWriter(outputTxtFile, true);
wjson = setupWriter(outputJsonFile, true);
......
......@@ -71,7 +71,7 @@ public void run() {
pln(String.format("total elapsed time: %dms", r.total_elapsed_time));
writerWriteFlushClose(wjson, gson.toJson(r), oj);
writerWriteFlushClose(ejson, gson.toJson(errors), ej);
writerWriteFlushClose(ejson, gsonPretty.toJson(errors), ej);
ptxt.flush();
ptxt.close();
......