eclipse-archived / packagedrone

Eclipse Package Drone
http://eclipse.org/package-drone
Eclipse Public License 1.0
66 stars 39 forks source link

Update RpmInputStream.java #142

Open ghost opened 5 years ago

ghost commented 5 years ago

Removed many calls to ensureInit by placing it in the constructor.

ctron commented 5 years ago

Hi @krustocious27 Thank you for the PR. First of all, the RPM code moved on to the Eclipse Packager project (https://projects.eclipse.org/projects/technology.packager) … I know I have to make this more transparent.

However I also see a technical problem with your PR. Yes, there are now less calls to the "ensureInit" method, but would it leak streams in case of an exception.

Assume your are doing something like try ( x = new RpmInputStream(s) { … }. My expectation would be, that the close method gets called at the end of the block, and s gets closed. However in the changed behavior, the constructor of RpmInputStream would fail, and not call the close method and s might be leaked.