incubator-odf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Torsten Krah (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ODFTOOLKIT-327) java.lang.NullPointerException at org.odftoolkit.odfdom.pkg.OdfPackage.logValidationError(OdfPackage.java:2028)
Date Thu, 13 Sep 2012 12:45:07 GMT

    [ https://issues.apache.org/jira/browse/ODFTOOLKIT-327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13454859#comment-13454859
] 

Torsten Krah commented on ODFTOOLKIT-327:
-----------------------------------------

Workaround:

Create the OdfPackage by yourself and use a custom ErrorHandler - can be NoOpHandler or like
the default one - and pass it to the loadDocument stuff, e.g.:

final OdfPackage odfPkg = OdfPackage.loadPackage(file, new DefaultErrorHandler());
final OdfDocument odfDocument = OdfDocument.loadDocument(odfPkg);

For the Fix a document should not be needed, can be done by looking at the code. In many places
of OdfPackage any callers does check, if an error handler is installed at all, the offending
logValidationError method does not check for null - fixing this should be simple.
                
> java.lang.NullPointerException at org.odftoolkit.odfdom.pkg.OdfPackage.logValidationError(OdfPackage.java:2028)
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: ODFTOOLKIT-327
>                 URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-327
>             Project: ODF Toolkit
>          Issue Type: Bug
>          Components: java, odfdom, simple api
>    Affects Versions: 0.8.7, 0.8.8
>            Reporter: Vicente Villegas Larios
>
> Hello guys I'm facing an issue when I try to load an odp file, researching in the web
seems like the only solution is to open those files and save it. But I cannot do that I'm
running a batch process which mean  that I will process many files. 
> I'm using the following code in my constructor and it is working with the majority of
odp files but for some reason there are some files that are throwing the following exception.
> **** This is the constructor 
> public OdpTest(File documentToExtract) throws ExtractionException, Exception {
> 		org.odftoolkit.simple.Document document = PresentationDocument.loadDocument(documentToExtract);
> 	}
> **** This is the exception
> Throwable occurred: java.lang.NullPointerException
> 	at org.odftoolkit.odfdom.pkg.OdfPackage.logValidationError(OdfPackage.java:2028)
> 	at org.odftoolkit.odfdom.pkg.OdfPackage.parseManifest(OdfPackage.java:965)
> 	at org.odftoolkit.odfdom.pkg.OdfPackage.readZip(OdfPackage.java:338)
> 	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:255)
> 	at org.odftoolkit.simple.Document.loadDocument(Document.java:302)
> 	at org.odftoolkit.simple.PresentationDocument.loadDocument(PresentationDocument.java:327)
> why that line is throwing that exception for some files?
> is there a version that is fixing that issue?
> please help me
> thanks in advance

--
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

Mime
View raw message