Jean-Baptiste Lièvremont created ODFTOOLKIT-353:
---------------------------------------------------

             Summary: NullPointerException caused by ZipException, loading file 
generated by LibreOffice 3.6
                 Key: ODFTOOLKIT-353
                 URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-353
             Project: ODF Toolkit
          Issue Type: Bug
          Components: odfdom
    Affects Versions: odfdom-0.8.7, odfdom-0.8.8
         Environment: Oracle JDK 1.6.0_22 x64
Windows 7 Professional 64 bits
LibreOffice 3.6
            Reporter: Jean-Baptiste Lièvremont
         Attachments: empty.odt

I am trying to load the attached (?) empty ODT file generated with LibreOffice 
3.6. I put the file on the classpath in order to be able to load it through 
getResourceAsStream.

The NPE is as follows:
java.lang.NullPointerException
        at org.odftoolkit.odfdom.pkg.ZipHelper.entriesToMap(ZipHelper.java:86)
        at org.odftoolkit.odfdom.pkg.OdfPackage.readZip(OdfPackage.java:329)
        at 
org.odftoolkit.odfdom.pkg.OdfPackage.initializeZip(OdfPackage.java:324)
        at org.odftoolkit.odfdom.pkg.OdfPackage.<init>(OdfPackage.java:220)
        at org.odftoolkit.odfdom.pkg.OdfPackage.loadPackage(OdfPackage.java:275)
        at 
org.odftoolkit.odfdom.doc.OdfDocument.loadDocument(OdfDocument.java:219)
        at 
org.odftoolkit.odfdom.doc.OdfTextDocument.loadDocument(OdfTextDocument.java:150)
        at (redacted)

Debugging into ZipHelper, I found that the NPE is caused by an erroneous access 
to the "Java.version" system property (which shoud probably read "java.version" 
- in lowercase).

Now, if I explicitly define Java.version (-DJava.version=1.6.0), I get the 
following ZipException:

java.util.zip.ZipException: invalid entry CRC (expected 0xef5e424d but got 
0x585c5715)
        at java.util.zip.ZipInputStream.read(ZipInputStream.java:179)
        at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:100)
        at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:78)
        at org.odftoolkit.odfdom.pkg.ZipHelper.entriesToMap(ZipHelper.java:83)
        at org.odftoolkit.odfdom.pkg.OdfPackage.readZip(OdfPackage.java:329)
        at 
org.odftoolkit.odfdom.pkg.OdfPackage.initializeZip(OdfPackage.java:324)
        at org.odftoolkit.odfdom.pkg.OdfPackage.<init>(OdfPackage.java:220)
        at org.odftoolkit.odfdom.pkg.OdfPackage.loadPackage(OdfPackage.java:275)
        at 
org.odftoolkit.odfdom.doc.OdfDocument.loadDocument(OdfDocument.java:219)
        at 
org.odftoolkit.odfdom.doc.OdfTextDocument.loadDocument(OdfTextDocument.java:150)
        at (redacted)

Of course, the file loads just fine in LibreOffice 3.6, as well as 7-Zip, but 
e.g Word 2010 also says that it is corrupt.

So my guess is that the ZipException is somehow provoked by an issue with 
LibreOffice 3.6 (but should not 7-Zip also complain in case of a bad CRC ?).

Anyhow, there is an unprotected read - and comparison - of an unexisting system 
property.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to