Bug 62378 - Write Data | Rule M2.4 exception occurred and corrupts the file.
Summary: Write Data | Rule M2.4 exception occurred and corrupts the file.
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.14-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2018-05-16 11:10 UTC by nishantaggarwal2
Modified: 2018-06-28 15:22 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description nishantaggarwal2 2018-05-16 11:10:14 UTC

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


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


.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.