You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2014/09/11 09:39:03 UTC
[Bug 56957] New: Excel 2007 file is unusable after closing Workbook
object
https://issues.apache.org/bugzilla/show_bug.cgi?id=56957
Bug ID: 56957
Summary: Excel 2007 file is unusable after closing Workbook
object
Product: POI
Version: 3.11-dev
Hardware: PC
OS: All
Status: NEW
Severity: blocker
Priority: P2
Component: XSSF
Assignee: dev@poi.apache.org
Reporter: armen.vardanyan@scdm.de
Created attachment 31999
--> https://issues.apache.org/bugzilla/attachment.cgi?id=31999&action=edit
excel files and java source file
I am reading an Excel 2007 file(xlsx format). After the first read, when I
close the Workbook object, the second time I run the Java application, I get
exception in Eclipse.
I am using the latest release of POI available in maven repositories, i.e. 3.11
beta2. Tested on both Windows and Linux, Java 7 and Java 8, the problem
persists in all cases
This happens ONLY on Microsoft Excel 2007 XLSX files. It does not happen when
using Microsoft Excel 2013 XLSX files.
///////////////////////////////////////////////////////////////////
The error I am getting in Eclipse console is the following:
Exception in thread "main" org.apache.poi.POIXMLException:
java.lang.reflect.InvocationTargetException
at
org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:62)
at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:427)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:162)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:236)
at
org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:109)
at Main.main(Main.java:17)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at
org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:60)
... 5 more
Caused by: java.io.IOException: error: Unexpected end of file after null
at
org.apache.poi.xssf.model.SharedStringsTable.readFrom(SharedStringsTable.java:129)
at
org.apache.poi.xssf.model.SharedStringsTable.<init>(SharedStringsTable.java:106)
... 10 more
//////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
The error I am getting from Microsoft Excel 2007 when opening the file after
this corruption, is the following:
"Excel found unreadable content in 'file_name.xlsx'. Do you want to recover the
contents of this workbook?"
When answering yes, it says:
"Excel was able to open the file by repairing or removing the unreadable
content. Removed Part: /xl/sharedStrings.xml part with XML error. (Strings) A
document must contain exactly one root element. Line 1, column 0."
///////////////////////////////////////////////////////////////////////////
I also attach
1. the Java source file I used to read the file(Main.java), and
2. the Excel 2007 XLSX file before corruption(Excel_2007_file_before.xlsx) and
after corruption(Excel_2007_file_after.xlsx)
The files are in 'all.zip' file
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56957] Excel 2007 file is unusable after closing Workbook
object
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56957
Robertiano <ro...@yahoo.es> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rober_20_02@yahoo.es
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56957] Excel 2007 file is unusable after closing Workbook
object
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56957
RatiKanata Pal <pa...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #3 from RatiKanata Pal <pa...@gmail.com> ---
What xbean version you are using?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56957] Excel 2007 file is unusable after closing Workbook
object
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56957
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #31999|application/octet-stream |application/zip
mime type| |
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56957] Excel 2007 file is unusable after closing Workbook
object
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56957
--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
I can reproduce the problem with your small test file
No idea why it's happening, hopefully someone else can investigate...
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56957] Excel 2007 file is unusable after closing Workbook
object
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56957
Armen Vardanyan <ar...@scdm.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |armen.vardanyan@scdm.de
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56957] Excel 2007 file is unusable after closing Workbook
object
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56957
RatiKanata Pal <pa...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pal.ratikanta@gmail.com
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56957] Excel 2007 file is unusable after closing Workbook
object
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56957
--- Comment #2 from Dominik Stadler <do...@gmx.at> ---
The problem is that the original xlsx does not contain a file for the
SharedString table in the zip-file and thus an empty string table is created
during loading the file initially.
During close(), the file is written back and a 0-byte sharedStrings.xml file is
created, which later fails during loading the xlsx again.
I tried it with the following change, which makes this test work, however I am
not sure if this is the correct way to exclude parts which do not have any
size:
---
a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPartMarshaller.java
+++
b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPartMarshaller.java
@@ -63,6 +63,11 @@ public final class ZipPartMarshaller implements
PartMarshaller {
// Normally should happen only in developement phase,
so just throw
// exception
}
+
+ // check if there is anything to save
+ if(part.getSize() == 0) {
+ return true;
+ }
ZipOutputStream zos = (ZipOutputStream) os;
ZipEntry partEntry = new ZipEntry(ZipHelper
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56957] Excel 2007 file is unusable after closing Workbook
object
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56957
Armen Vardanyan <ar...@scdm.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P2 |P1
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56957] Excel 2007 file is unusable after closing Workbook
object
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56957
Robertiano <ro...@yahoo.es> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
--- Comment #4 from Robertiano <ro...@yahoo.es> ---
I can reproduce the problem in 3.11 version with xmlbeans 2.6.0.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org