Skip to content

Commit 1a89ce1

Browse files
larsrc-googlecopybara-github
authored andcommitted
Make worker JSON protocol properly ignore unknown fields.
RELNOTES: None. PiperOrigin-RevId: 381428739
1 parent 7b548ed commit 1a89ce1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/com/google/devtools/build/lib/worker/JsonWorkerMessageProcessor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ private static ImmutableList<Input> readInputs(JsonReader reader) throws IOExcep
7979
path = reader.nextString();
8080
break;
8181
default:
82-
continue;
82+
// As per https://docs.bazel.build/versions/main/creating-workers.html#work-responses,
83+
// unknown fields are ignored.
84+
reader.skipValue();
85+
break;
8386
}
8487
}
8588
reader.endObject();
@@ -125,6 +128,9 @@ public WorkRequest readWorkRequest() throws IOException {
125128
requestId = reader.nextInt();
126129
break;
127130
default:
131+
// As per https://docs.bazel.build/versions/main/creating-workers.html#work-responses,
132+
// unknown fields are ignored.
133+
reader.skipValue();
128134
break;
129135
}
130136
}

0 commit comments

Comments
 (0)