This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Easy: Fix XctoolOutputParsing exception on empty JSON
Summary: If xctool is in a bad state, it can close stdout before printing anything (facebookarchive/xctool#656) That makes the JSON parser in `XctoolOutputParsing` fail: com.google.gson.JsonIOException: java.io.EOFException: End of input at line 1 column 1 at com.google.gson.JsonStreamParser.hasNext(JsonStreamParser.java:109) at com.facebook.buck.apple.XctoolOutputParsing.streamOutputFromReader(XctoolOutputParsing.java:147) at com.facebook.buck.apple.AppleTest$AppleTestXctoolStdoutReader.readStdout(AppleTest.java:138) at com.facebook.buck.apple.XctoolRunTestsStep.execute(XctoolRunTestsStep.java:292) at com.facebook.buck.step.DefaultStepRunner.runStepForBuildTarget(DefaultStepRunner.java:63) at com.facebook.buck.step.DefaultStepRunner$1.call(DefaultStepRunner.java:92) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.EOFException: End of input at line 1 column 1 at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1377) at com.google.gson.stream.JsonReader.consumeNonExecutePrefix(JsonReader.java:1514) at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:523) at com.google.gson.stream.JsonReader.peek(JsonReader.java:414) at com.google.gson.JsonStreamParser.hasNext(JsonStreamParser.java:105) ... 9 more This fixes the issue by cleanly handling exceptions from `hasNext()` and just ignoring the rest of the output. Test Plan: Unit tests updated. Confirmed test failed before fix and passed after fix. Reviewed By: ryu2 fb-gh-sync-id: 3d3a2e0
- Loading branch information