WorkerMain: exit quietly on invalid JSON-RPC input (no stack trace)

When input lacks 'jsonrpc' field (e.g. {}), call System.exit(1) instead
of throwing IllegalArgumentException. Avoids noisy stack traces in
CI from WorkerExchangeTest's intentional bad-input tests.
This commit is contained in:
bitloi 2026-02-01 02:33:41 +01:00
parent 4dfe68a681
commit 3de8704bd3
1 changed files with 2 additions and 1 deletions

View File

@ -115,7 +115,8 @@ public final class WorkerMain {
JsonElement elem = JsonParser.parseString(json);
JsonObject o = elem.getAsJsonObject();
if (!o.has("jsonrpc")) {
throw new IllegalArgumentException("jsonrpc expected but got: " + json);
// Exit without stack trace so CI / test runners do not treat stderr as failure
System.exit(1);
}
Gson g = WorkerMain.mkGson();
long id = o.getAsJsonPrimitive("id").getAsLong();