gemini-code-assist[bot] commented on code in PR #36164:
URL: https://github.com/apache/beam/pull/36164#discussion_r2350324027


##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/windmill/client/grpc/GetWorkResponseChunkAssembler.java:
##########
@@ -94,15 +96,17 @@ List<AssembledWorkItem> 
append(Windmill.StreamingGetWorkResponseChunk chunk) {
    */
   private Optional<AssembledWorkItem> flushToWorkItem() {
     try {
+      workItemBuilder.mergeFrom(data);
       return Optional.of(
           AssembledWorkItem.create(
-              WorkItem.parseFrom(data.newInput()),
+              workItemBuilder.build(),
               Preconditions.checkNotNull(metadata),
               workTimingInfosTracker.getLatencyAttributions(),
               bufferedSize));
-    } catch (IOException e) {
+    } catch (RuntimeException e) {

Review Comment:
   ![critical](https://www.gstatic.com/codereviewagent/critical.svg)
   
   The exception type in the `catch` block has been changed from `IOException` 
to `RuntimeException`. However, `workItemBuilder.mergeFrom(data)` (on line 99) 
can throw an `InvalidProtocolBufferException`, which is a checked exception 
that extends `IOException`. The `catch (RuntimeException e)` will not handle 
this checked exception, which will result in a compilation error since the 
`flushToWorkItem` method does not declare any thrown exceptions. Please revert 
the caught exception type to `IOException` to correctly handle parsing errors.
   
   ```suggestion
       } catch (IOException e) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to