scwhittle commented on code in PR #35942:
URL: https://github.com/apache/beam/pull/35942#discussion_r2297932323
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WindmillSink.java:
##########
@@ -146,8 +146,15 @@ private <EncodeT> ByteString encode(Coder<EncodeT> coder,
EncodeT object) throws
stream.size() == 0,
"Expected output stream to be empty but had %s",
stream.toByteString());
- coder.encode(object, stream, Coder.Context.OUTER);
- return stream.toByteStringAndReset();
+ ByteString result;
+ try {
+ coder.encode(object, stream, Coder.Context.OUTER);
+ result = stream.toByteStringAndReset();
+ } catch (IOException e) {
Review Comment:
How about catching Exception e? in case there is a RuntimeException the
coder throws
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WindmillSink.java:
##########
@@ -146,8 +146,15 @@ private <EncodeT> ByteString encode(Coder<EncodeT> coder,
EncodeT object) throws
stream.size() == 0,
"Expected output stream to be empty but had %s",
stream.toByteString());
- coder.encode(object, stream, Coder.Context.OUTER);
- return stream.toByteStringAndReset();
+ ByteString result;
+ try {
+ coder.encode(object, stream, Coder.Context.OUTER);
+ result = stream.toByteStringAndReset();
Review Comment:
nit: I think you can just
`return stream.toByteStringAndReset();`
and remove the result variable
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]