Bug 55033

Summary: new XSSFWorkbook(pkg) corrupts Excel file
Product: POI Reporter: est412 <est412>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P2    
Version: 3.9-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Corrupted file
Initial and rezulting test files

Description est412 2013-05-31 08:58:22 UTC
Created attachment 30347 [details]
Corrupted file

Hello!
This simple piece of code corrupts normal *.xlsx file.

------
pkg = OPCPackage.open(args[0]);
wb = new XSSFWorkbook(pkg);
pkg.close();
------

Without statement 
wb = new XSSFWorkbook(pkg);
*.xlsx file remains good.

Corrupted *.xlsx attached.
Thanx in advance!
Comment 1 Nick Burch 2013-05-31 09:05:02 UTC
Are you able to work out how the files differ? (You'll probably need to unzip both, then do a whitespace ignoring diff / xmllint -format then diff to work out the changes)
Comment 2 est412 2013-05-31 10:09:55 UTC
Created attachment 30348 [details]
Initial and rezulting test files
Comment 3 est412 2013-05-31 10:11:37 UTC
Unfortunately I not feel qualified enough to diff this files.
Attaching all of it instead.
Comment 4 Dominik Stadler 2015-09-07 20:15:18 UTC
I think this was fixed a long time ago. Nowadays you can also use open(String path, PackageAccess access) with PackageAccess.READ to avoid any writing back of the file.

Please reopen or submit a new bug report if there is still a problem with the latest version of POI.