Bug 62378

Summary: Write Data | Rule M2.4 exception occurred and corrupts the file.
Product: POI Reporter: nishantaggarwal2
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P2    
Version: 3.14-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description nishantaggarwal2 2018-05-16 11:10:14 UTC
Steps:

1. Load a file in the workbook and xssfsheet objects.
2. Access the file.
3. Try to write the data in the loaded file.

Issue: 

Exception occurs and corrupts the file and make it 0 KB.

Exception: 

.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:958)
	at org.apache.poi.openxml4j.opc.PackagePart.getOutputStream(PackagePart.java:522)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.commit(XSSFWorkbook.java:1687)
	at org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:464)
	at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:211)
Comment 1 Dominik Stadler 2018-05-16 14:23:37 UTC
Can you post a minimal set of code which reproduces this? It seems to be happening during writing and it might be related to what you actually do before in your code.
Comment 2 nishantaggarwal2 2018-05-18 05:49:01 UTC
I have loaded the workbook in the workbook object and sheet in xssf sheet. 
Before writing the data I have read the data from it then write the data by using same workbook and sheet object.
Comment 3 Mark Murphy 2018-05-18 10:49:20 UTC
Need code. Can't help otherwise.
Comment 4 Dominik Stadler 2018-06-28 15:22:36 UTC
We cannot do much without code or sample documents, so this is bug-report is INVALID until we receive more information.