Bug 60141 - Executing a program in Eclipse is displaying an exception on the console: "Exception in thread "main" org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException: Rule M2.4 exception"
Summary: Executing a program in Eclipse is displaying an exception on the console: "Ex...
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.14-FINAL
Hardware: PC All
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-15 16:41 UTC by Vishal Pamnani
Modified: 2016-10-11 14:29 UTC (History)
0 users



Attachments
Data Driven Testing (1.75 KB, text/plain)
2016-09-15 16:41 UTC, Vishal Pamnani
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vishal Pamnani 2016-09-15 16:41:11 UTC
Created attachment 34253 [details]
Data Driven Testing

Executing a program in Eclipse is displaying an exception on the console: "Exception in thread "main" org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException: Rule M2.4 exception"

Refer to the attached .java file.
Comment 1 Javen O'Neal 2016-09-15 17:48:00 UTC
Can you provide a stack trace to know where the exception is coming from? You might need to run this in debug mode with breakpoints to figure out which line is causing the error.

My guess is that it's breaking at wb.write(fos), since you never closed your file input stream and in Windows opening a file gets an exclusive lock until the resource is closed.

Some suggestions:
* Open with a File instead of a FileInputStream
* Write to a different file than you read (and back up the original file in case you accidentally mangle it)
Comment 2 Dominik Stadler 2016-10-11 14:29:22 UTC
No update on the requested information for some time, therefore I am closing this as INVALID for now, please reopen with more information if this is still a problem for you.