kbendick opened a new pull request, #5259:
URL: https://github.com/apache/iceberg/pull/5259

   The `runSafely` function gives an error prone warning for throwing from a 
finally block.
   
   Originally, we fixed this via suppression in 
https://github.com/apache/iceberg/pull/5190, but I noticed this function was 
unused and so chose to deprecate it instead in 
https://github.com/apache/iceberg/pull/5205.
   
   @rdblue wanted to keep the function, as its tested and could be useful in 
the future.
   
   So this PR:
   - fixes the issue discovered in #5190 of throwing `failure` when it's null
   - attempts to throw `failure` after adding `e` as a suppressed error when 
it's non-null
   - adds the `@Finally` suppression to remove the error prone log from the 
build.
   
   Warning that is logged on build:
   ```
   iceberg/api/src/main/java/org/apache/iceberg/util/ExceptionUtil.java:124: 
warning: [Finally] If you return or throw from a finally, then values returned 
or thrown from the try-catch block will be ignored. Consider using 
try-with-resources instead.
               throw new RuntimeException("Unknown exception in finally block", 
failure);
               ^
       (see https://errorprone.info/bugpattern/Finally)
   ``` 
   
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to