Bug 58731

Summary: Exception in thread "main" org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException:
Product: POI Reporter: Pankaj Sinha <psinha18>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: normal CC: psinha18
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Code file attached
Excel file attached

Description Pankaj Sinha 2015-12-14 11:04:13 UTC
Created attachment 33347 [details]
Code file attached

I ran a siple java code and got he below stated exception and reading the exception it says that such error should not come up and asked to log the issue.

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:943)
	at org.apache.poi.openxml4j.opc.PackagePart.getOutputStream(PackagePart.java:522)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.commit(XSSFWorkbook.java:1678)
	at org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:341)
	at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:206)
	at Package1.ReadFile.main(ReadFile.java:136)
Comment 1 Nick Burch 2015-12-14 11:26:55 UTC
Can you please upload the file that triggers the exception?

Without a problematic file, there's almost nothing we can do to diagnose it
Comment 2 Pankaj Sinha 2015-12-14 12:00:56 UTC
The file is already attached in .txt format with the simple code present therein. Attached file name: "Code File attached" in the attachment section.
Comment 3 Pankaj Sinha 2015-12-14 12:01:10 UTC
Changed status to New
Comment 4 Nick Burch 2015-12-14 16:47:58 UTC
You've attached the Java code, we need the Microsoft Excel file you're using to trigger the exception
Comment 5 Pankaj Sinha 2015-12-15 07:59:33 UTC
Created attachment 33350 [details]
Excel file attached

Please find attached herewith the required file triggering the issue..


Additional note: Exception in thread "main" 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!
Comment 6 Nick Burch 2015-12-16 18:18:14 UTC
I've had a go at turning your file + code into a unit test, in r1720411. It's test58731() in TestXSSFBugs. Can you try to see what's different in our test to your code? Only the test is passing in the junit code
Comment 7 Dominik Stadler 2015-12-17 12:39:21 UTC
Please note that the unit test did have a few issues and was not executed in CI at all, but even after those fixes it is running fine and does not reproduce the reported problem.
Comment 8 Pankaj Sinha 2015-12-30 07:03:09 UTC
This issue is not appearing now with the same lines of codes. Hence, the issue can be closed.
Comment 9 Dominik Stadler 2015-12-30 16:06:29 UTC
Closing as requested by the original reporter