thswlsqls opened a new pull request, #8768:
URL: https://github.com/apache/paimon/pull/8768

   ### Purpose
   
   fix #8765
   
   - `FileIndexFormat.Reader.<init>` only closed the owned 
`SeekableInputStream` on `IOException`.
   - A corrupt or wrong-version index file throws a `RuntimeException` from the 
magic/version checks inside the same `try` block, escaping the `catch` and 
leaking the file descriptor.
   - Because the constructor throws before returning, the caller's 
try-with-resources never binds the `Reader`, so `close()` never runs.
   - Widen the catch to `IOException | RuntimeException`, mirroring the 
existing IOException branch that already closes the stream.
   
   ### Tests
   
   - Added `FileIndexFormatFormatTest#testReaderClosesInputStreamOnBadMagic` 
and `#testReaderClosesInputStreamOnUnsupportedVersion`, using a close-recording 
`SeekableInputStream` wrapper; both fail on master and pass with the fix.
   - `mvn -pl paimon-common -DfailIfNoTests=false clean install` passed (JDK 
11), including checkstyle, spotless, and rat.
   


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