Bug 59318 - File writing error after opening the file: Rule M2.4 exception: this should NEVER happen
Summary: File writing error after opening the file: Rule M2.4 exception: this should N...
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.14-FINAL
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-14 04:41 UTC by Jeff
Modified: 2016-05-17 19:39 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff 2016-04-14 04:41:44 UTC
Opened an xlsx file using 
      	Workbook book = WorkbookFactory.create(filepath);

Error was generated on attempting to close the file using
      	fileOut = new FileOutputStream(filepath);
   	book.write(fileOut);
    	setFile(filepath);
Comment 1 Javen O'Neal 2016-04-14 04:48:46 UTC
Could you attach the file that causes the problem and include a full stack trace so we can reproduce this bug.
Comment 2 Dominik Stadler 2016-04-14 05:22:33 UTC
Also POI does currently not fully support overwriting the file that you still have open, it might work but also might be related here. Therefore please try to write to a different file and see if the error persists or goes away.
Comment 3 Javen O'Neal 2016-04-14 06:33:56 UTC
In my POI-powered applications, I write to a temporary file, close the workbook, rename the original to "backup", then rename the temp to the original filename. If you don't want the backup file, delete it instead of renaming it.
Comment 4 Dominik Stadler 2016-05-17 19:39:53 UTC
No response on the requested information, thus there is currently nothing that we can take a close look on. For now please try to write to a different file first to see if that makes it work as POI does not support overwriting the source-file by design currently.