Bug 59356

Summary: log printed message: this error should NEVER happen! Please raise a bug at https://bz.apache.org/bugzilla/enter_bug.cgi?product=POI
Product: POI Reporter: scorpdaddy <scorpdaddy.ch>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED DUPLICATE    
Severity: normal CC: jzhao
Priority: P2    
Version: 3.15-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description scorpdaddy 2016-04-19 17:08:05 UTC
• read workbook from file
• workbook.close()
• made changes in a sheet in workbook
• workbook.write(FileOutputStream to original file)
Failed on workbook.write(os);

Can't upload file because it is 10x the upload limit.



<logsnippet>

ERROR(NhlDayAnalysis) 2016-04-19 13:58:35.507: com.shiftenergy.nhlDayAnalysis.SmoothZoneTemps.run() failed
Exception: org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException
Rule M2.4 exception : this error should NEVER happen! Please raise a bug at https://bz.apache.org/bugzilla/enter_bug.cgi?product=POI and attach a file that triggers it, thanks!

org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException: Rule M2.4 exception : this error should NEVER happen! Please raise a bug at https://bz.apache.org/bugzilla/enter_bug.cgi?product=POI and attach a file that triggers it, thanks!
	at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.getContentType(ContentTypeManager.java:343)
	at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.removeContentType(ContentTypeManager.java:256)
	at org.apache.poi.openxml4j.opc.OPCPackage.removePart(OPCPackage.java:975)
	at org.apache.poi.openxml4j.opc.PackagePart.getOutputStream(PackagePart.java:522)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.commit(XSSFWorkbook.java:1677)
	at org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:464)
	at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:193)
	at com.shiftenergy.nhlDayAnalysis.SmoothZoneTemps.run(SmoothZoneTemps.java:101)
	at java.lang.Thread.run(Thread.java:745)



</logsnippet>
Comment 1 Dominik Stadler 2016-05-17 19:33:11 UTC
Hmm, not much chance to reproduce this without the actual code and a file that reproduces it. Is it still happening if you delete some stuff from the sample-file?
Comment 2 Dominik Stadler 2016-07-26 05:54:21 UTC
In r1753912 we clarified the JavaDoc of the close() method to state that you should not use the object any more after calling close(), so the "fix" here is likely to not call close() until you are done with the file.

*** This bug has been marked as a duplicate of bug 59634 ***