pjfanning opened a new pull request, #1929:
URL: https://github.com/apache/pekko-connectors/pull/1929

   `ZipEntrySource` and `ZipSource` both opened the archive in the body of 
their `GraphStageLogic`:
   
   ```scala
   val zis = new ZipInputStream(new FileInputStream(f), fileCharset)
   ```
   
   Both close it in `postStop()`, so the ordinary path was never leaking. Two 
narrower problems:
   
   * A logic that is constructed but whose materialization then fails never 
reaches `postStop`, so the handle is never released. Pekko's guidance is to 
acquire in `preStart` for exactly this reason.
   * If the `ZipInputStream` constructor throws — an unsupported charset, say — 
the `FileInputStream` it was handed is orphaned with no reference left to close 
it.
   
   Acquisition moves to `preStart`, and a small `openZip` helper closes the 
underlying file if the zip stream cannot be opened, attaching any secondary 
failure as a suppressed exception. `postStop` null-guards, since it also runs 
for a logic that never started.
   
   ### Behaviour change
   
   Failing to open the archive now fails the stream instead of throwing out of 
the caller. Previously the exception escaped from `runWith` synchronously, 
because logic construction happens during materialization; now it arrives as a 
failed future like every other stage failure. The new test asserts this, and it 
does fail against the current code — with `FileNotFoundException` thrown rather 
than returned — so it is a real guard rather than a restatement.
   
   `file/test` passes (62) and `checkCodeStyle` is clean.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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