PDGGK commented on PR #39711:
URL: https://github.com/apache/beam/pull/39711#issuecomment-5296391408

   @waterWang — both red checks here are one compile error, and the bot won't 
assign a reviewer until they're green, so this has been stuck on it since 
Monday. Passing on the diagnosis rather than let it sit:
   
   ```
   
sdks/java/io/hbase/src/main/java/org/apache/beam/sdk/io/hbase/HBaseIO.java:556: 
error:
       exception IOException is never thrown in body of corresponding try 
statement
             } catch (IOException e) {
               ^
   > Task :sdks:java:io:hbase:compileJava FAILED
   ```
   
   `beam_PreCommit_Spotless` fails for the same reason, not for formatting — it 
runs `checkStyleMain`, which needs the module to compile first. So there is one 
thing to fix, not two.
   
   The cause is the `scanner` half. HBase's `ResultScanner` narrows 
`Closeable.close()` to a plain `void close()` with no checked exception, so a 
`catch (IOException e)` around `scanner.close()` is unreachable and javac 
rejects it. `Connection.close()` does declare `throws IOException`, which is 
why the second block is fine.
   
   Catching `Exception` there instead compiles and still collects the failure:
   
   ```java
   if (scanner != null) {
     try {
       scanner.close();
     } catch (Exception e) {
       thrown = ...;
     } finally {
       scanner = null;
     }
   }
   ```
   
   That also picks up a `RuntimeException` from `close()`, which the narrowed 
signature makes the likelier failure anyway.
   
   Standing by what I said on my side: yours was first on the clock and I have 
no interest in a race — I'd just rather it not be blocked by a one-line compile 
error nobody mentioned for three days. If a committer would like the tests from 
#39712 folded in here, say the word and I'll close mine.
   


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

Reply via email to