Skip to content

Commit

Permalink
Make worker JSON protocol properly ignore unknown fields.
Browse files Browse the repository at this point in the history
RELNOTES: None.
PiperOrigin-RevId: 381428739
  • Loading branch information
larsrc-google authored and copybara-github committed Jun 25, 2021
1 parent 7b548ed commit 1a89ce1
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ private static ImmutableList<Input> readInputs(JsonReader reader) throws IOExcep
path = reader.nextString();
break;
default:
continue;
// As per https://docs.bazel.build/versions/main/creating-workers.html#work-responses,
// unknown fields are ignored.
reader.skipValue();
break;
}
}
reader.endObject();
Expand Down Expand Up @@ -125,6 +128,9 @@ public WorkRequest readWorkRequest() throws IOException {
requestId = reader.nextInt();
break;
default:
// As per https://docs.bazel.build/versions/main/creating-workers.html#work-responses,
// unknown fields are ignored.
reader.skipValue();
break;
}
}
Expand Down

0 comments on commit 1a89ce1

Please sign in to comment.