Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when attempting to "doValidate" on a non-epub #1050

Closed
karenhanson opened this issue Jun 4, 2019 · 1 comment · Fixed by #1134
Closed

NullPointerException when attempting to "doValidate" on a non-epub #1050

karenhanson opened this issue Jun 4, 2019 · 1 comment · Fixed by #1134
Labels
priority: medium To be processed and published in one of the upcoming releases status: has PR The issue is being processed in a pull request type: bug The issue describes a bug
Milestone

Comments

@karenhanson
Copy link

karenhanson commented Jun 4, 2019

I'm using the EPUBCheck as a Java library to create an EPUB JHOVE module that we can plug into our existing validation workflow. In one unit test I passed in a .docx file to see if it would fail gracefully when a non-EPUB is accidentally provided. The result is a NullPointerException. Stepping through, it seems to be assuming there is a META-INF/container.xml even though the file isn't even a .zip file, and the absence of this file causes a NPE:

java.lang.NullPointerException
	at com.adobe.epubcheck.xml.XMLParser.process(XMLParser.java:200)
	at com.adobe.epubcheck.ocf.OCFPackage$1.get(OCFPackage.java:41)
	at com.adobe.epubcheck.ocf.OCFPackage$1.get(OCFPackage.java:31)
	at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:164)
	at com.adobe.epubcheck.ocf.OCFPackage.getOcfData(OCFPackage.java:148)
	at com.adobe.epubcheck.api.EpubCheck.checkExtension(EpubCheck.java:270)
	at com.adobe.epubcheck.api.EpubCheck.doValidate(EpubCheck.java:227)
	at org.ithaka.portico.jhove.module.EpubModule.parse(EpubModule.java:297)
@rdeltour rdeltour added priority: medium To be processed and published in one of the upcoming releases status: accepted Ready to be further processed type: bug The issue describes a bug labels Jun 4, 2019
@rdeltour
Copy link
Member

rdeltour commented Jun 4, 2019

Thanks for the report! EPUBCheck should fail more gracefully indeed :-)

@rdeltour rdeltour added this to the 4.3.3 milestone Sep 11, 2019
rdeltour added a commit that referenced this issue Apr 30, 2020
Running EPUBCheck on a non-EPUB package file (for instance an Office
Open XML document) caused a a `NullPointerException`.
It now fails gracefully with a fatal error (RSC-002) potentially followed
by side-effect errors (typically RSC-001, PKG-006).

Fixes #1050
@rdeltour rdeltour added status: has PR The issue is being processed in a pull request and removed status: accepted Ready to be further processed labels Apr 30, 2020
rdeltour added a commit that referenced this issue May 1, 2020
Running EPUBCheck on a non-EPUB package file (for instance an Office
Open XML document) caused a a `NullPointerException`.
It now fails gracefully with a fatal error (RSC-002) potentially followed
by side-effect errors (typically RSC-001, PKG-006).

Fixes #1050
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium To be processed and published in one of the upcoming releases status: has PR The issue is being processed in a pull request type: bug The issue describes a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants