Bug 55948 - Opening empty workbook in read-only mode fails
Summary: Opening empty workbook in read-only mode fails
Status: RESOLVED DUPLICATE of bug 57482
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.9-FINAL
Hardware: Macintosh All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-02 13:39 UTC by David Carr
Modified: 2015-01-22 15:04 UTC (History)
0 users



Attachments
empty workbook (25.80 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2014-01-02 13:39 UTC, David Carr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Carr 2014-01-02 13:39:03 UTC
Created attachment 31168 [details]
empty workbook

When running the following code on the attached file, I get an exception.  The file was created by Microsoft Excel for Mac 2011, Version 14.3.9 (131030), by creating a new workbook and saving it without making any changes.

new XSSFWorkbook(OPCPackage.open(file, PackageAccess.READ))

org.apache.poi.POIXMLException: org.apache.poi.openxml4j.exceptions.InvalidOperationException: Operation not allowed, document open in read only mode!
	at org.apache.poi.POIXMLDocumentPart.createRelationship(POIXMLDocumentPart.java:370)
	at org.apache.poi.POIXMLDocumentPart.createRelationship(POIXMLDocumentPart.java:330)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.onDocumentRead(XSSFWorkbook.java:274)
	at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:159)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:186)
	at com.commercehub.griddle.poi.XSSFTabularDataSource.openWorkbook(XSSFTabularDataSource.groovy:24)
	at com.commercehub.griddle.poi.WorkbookTabularDataSource.withFile(WorkbookTabularDataSource.groovy:16)
	at com.commercehub.griddle.poi.XSSFTabularDataSourceSpec.table rows have expected values(XSSFTabularDataSourceSpec.groovy:62)
Caused by: org.apache.poi.openxml4j.exceptions.InvalidOperationException: Operation not allowed, document open in read only mode!
	at org.apache.poi.openxml4j.opc.OPCPackage.throwExceptionIfReadOnly(OPCPackage.java:504)
	at org.apache.poi.openxml4j.opc.OPCPackage.createPart(OPCPackage.java:762)
	at org.apache.poi.openxml4j.opc.OPCPackage.createPart(OPCPackage.java:738)
	at org.apache.poi.POIXMLDocumentPart.createRelationship(POIXMLDocumentPart.java:350)
	... 7 more
Comment 1 Dominik Stadler 2015-01-22 15:04:09 UTC
Should be fixed in trunk via bug 57482, checked in with r1653825.

*** This bug has been marked as a duplicate of bug 57482 ***