Skip to content

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

@karenhanson

Description

@karenhanson

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumTo be processed and published in one of the upcoming releasesstatus: has PRThe issue is being processed in a pull requesttype: bugThe issue describes a bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions