• 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>
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?
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 ***