kitoha opened a new pull request, #7715:
URL: https://github.com/apache/gravitino/pull/7715

   
   ## Title: [#7682] Use Path + Files.newInputStream in GCSTokenProvider
   
   ### What changes were proposed in this pull request?
   
   - Replaced legacy I/O with NIO
   
     - java.io.File / FileInputStream → java.nio.file.Path / 
Files.newInputStream
   
   - Introduced try‑with‑resources to guarantee stream closure.
   
   - Removed redundant exists() check
   
      -  Eliminates TOCTOU risk, NoSuchFileException is now handled explicitly.
   
   - Add root cause in exception message.
   
   ### Why are the changes needed?
   
   - Resource‑leak prevention – prior code could leave file descriptors open on 
exceptions.
   
   - Modern API adoption – java.nio.file provides better link/permission 
handling and futureproofs the codebase.
   
   - Race‑condition mitigation – removing the pre‑check avoids TOCTOU between 
exists() and file opening.
   
   Fix: #7682
   
   ### Does this PR introduce _any_ user-facing change?
   
   No
   
   ### How was this patch tested?
   
   


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