Skip to content

NullPointerException on EPUB containing invalid links in Navigation Document #1516

Description

@shiestyle

We found a NullPointerException case when navigation document has an incorrect link.

<nav epub:type="toc" id="toc">
<h1>Navigation</h1>
<ol>
<li><a href="xhtml/p-cover.xhtml">cover</a></li>
<li><a href="xhtml/p-001.xhtml#xxx">p-001</a></li>
</ol>
</nav>

If p-001.xhtml doesn't have an anchor #xxx, NullPointerException will be occurred.

Sorry but Japanese error messages are included.

ERROR(RSC-012): C:\t\20230306-errordata.epub/item/navigation-documents.xhtml(18,37): フラグメント識別子が定義されていません.
java.lang.NullPointerException: Cannot invoke "java.util.List.indexOf(Object)" because the return value of "java.util.Map.get(Object)" is null
	at org.w3c.epubcheck.core.references.ResourceRegistry.getIDPosition(ResourceRegistry.java:57)
	at org.w3c.epubcheck.core.references.ResourceReferencesChecker.checkReadingOrder(ResourceReferencesChecker.java:451)
	at org.w3c.epubcheck.core.references.ResourceReferencesChecker.check(ResourceReferencesChecker.java:105)
	at com.adobe.epubcheck.opf.OPFChecker.checkPackage(OPFChecker.java:149)
	at com.adobe.epubcheck.opf.OPFChecker30.checkPackage(OPFChecker30.java:67)
	at com.adobe.epubcheck.opf.OPFChecker.check(OPFChecker.java:94)
	at com.adobe.epubcheck.ocf.OCFChecker.check(OCFChecker.java:174)
	at com.adobe.epubcheck.api.EpubCheck.doValidate(EpubCheck.java:218)
	at com.adobe.epubcheck.tool.EpubChecker.validateFile(EpubChecker.java:245)
	at com.adobe.epubcheck.tool.EpubChecker.processFile(EpubChecker.java:320)
	at com.adobe.epubcheck.tool.EpubChecker.run(EpubChecker.java:145)
	at com.adobe.epubcheck.tool.Checker.main(Checker.java:31)

Activity

  1. self-assigned this
    on Jun 30, 2023
  2. added a commit that references this issue on Jul 6, 2023
    f7b5dd9
  3. added
    status: has PRThe issue is being processed in a pull request
    and removed on Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

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

    ⌂ 换网址