Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 392861 - Incorrectly closed streams in Jar Processor
Summary: Incorrectly closed streams in Jar Processor
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: Kepler M4   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 390056
  Show dependency tree
 
Reported: 2012-10-25 15:12 EDT by Curtis Windatt CLA
Modified: 2012-11-14 11:30 EST (History)
2 users (show)

See Also:


Attachments
Fix for unclosed streams (9.63 KB, patch)
2012-10-25 15:41 EDT, Curtis Windatt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis Windatt CLA 2012-10-25 15:12:30 EDT
Surfaced in the PDE Build tests with changes in Bug 387557.  Marked as major as it could break signing in a build.

I'll provide a patch once I check that I've caught all the cases.

This could be avoided in the future by turning on JDT's potential resource leak checker.  However, the use of Utils.close() means that the builder returns a lot of false positive.
Comment 1 Curtis Windatt CLA 2012-10-25 15:34:11 EDT
Something else that might be worth looking into.  In some of the tests, when closing one zip entry and moving to the next, there is an off-by-one error in the byte size.  This threw an exception and left a stream open.  While my patch will fix the resource leak, I am not sure whether the incorrect size is a problem or not.

     [null] Signing JAR: C:\Users\windattc\Documents\WS\junit-workspace\pde.build\265726\buildRepo\plugins\org.eclipse.e4.core.di.extensions_0.11.0.v20120523-2004.jar to C:\Users\windattc\Documents\WS\junit-workspace\pde.build\265726\buildRepo\plugins\org.eclipse.e4.core.di.extensions_0.11.0.v20120523-2004.jar as pde.build
     [null] Enter Passphrase for keystore: Enter key password for pde.build: 
[p2.process.artifacts] java.util.zip.ZipException: invalid entry compressed size (expected 574 but got 575 bytes)
[p2.process.artifacts] 	at java.util.zip.ZipOutputStream.closeEntry(ZipOutputStream.java:259)
[p2.process.artifacts] 	at org.eclipse.equinox.internal.p2.jarprocessor.unsigner.Unsigner.processJar(Unsigner.java:103)
[p2.process.artifacts] 	at org.eclipse.equinox.internal.p2.jarprocessor.unsigner.Unsigner.execute(Unsigner.java:67)
[p2.process.artifacts] 	at org.eclipse.equinox.internal.p2.jarprocessor.unsigner.UnsignCommand.execute(UnsignCommand.java:35)
[p2.process.artifacts] 	at org.eclipse.equinox.internal.p2.jarprocessor.unsigner.UnsignCommand.postProcess(UnsignCommand.java:26)
[p2.process.artifacts] 	at org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessor.postProcess(JarProcessor.java:252)
Comment 2 Curtis Windatt CLA 2012-10-25 15:41:31 EDT
Created attachment 222849 [details]
Fix for unclosed streams
Comment 3 Thomas Watson CLA 2012-10-31 11:15:29 EDT
This week is M3.  I imagine this needs to be pushed to M4?
Comment 4 John Arthorne CLA 2012-11-14 11:30:46 EST
Thanks Curtis, I have reviewed your fix and committed with a few minor tweaks:

http://git.eclipse.org/c/equinox/rt.equinox.p2.git/commit/?id=1971740ba62534120d9f33162963d4517c898424