Skip to content

Add null check for locator in NonVerifyingHandler.startElement()#449

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-nullpointerexception-in-nonverifyinghandler
Draft

Add null check for locator in NonVerifyingHandler.startElement()#449
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-nullpointerexception-in-nonverifyinghandler

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

NonVerifyingHandler.startElement() dereferences locator without a null guard, unlike the parent class XOMHandler.startElement() which checks locator != null before calling getSystemId(). If a SAX parser omits the setDocumentLocator() call, this causes an NPE.

  • Wrapped the locator.getSystemId() block in a null check, matching the existing pattern in XOMHandler:
if (locator != null) {
     String baseURI = locator.getSystemId();
     if (baseURI != null && !baseURI.equals(documentBaseURI)) {
         element.setActualBaseURI(baseURI);
     }
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • docbook.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-21dfcdbaef38c632/dbs/java/working/files-to-index16764399873775334931.list --sourceArchiveDir=/tmp/codeql-scratch-21dfcdbaef38c632/dbs/java/src --outputDir=/tmp/codeql-scratch-21dfcdbaef38c632/dbs/java/trap/java ork/xom/xom/ivy/xercesImpl-2.12.2.jar:/home/REDACTED/work/xom/xom/build/classes:/home/REDACTED/work/commit rgo/bin/git (dns block)
  • www.oasis-open.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-21dfcdbaef38c632/dbs/java/working/files-to-index16764399873775334931.list --sourceArchiveDir=/tmp/codeql-scratch-21dfcdbaef38c632/dbs/java/src --outputDir=/tmp/codeql-scratch-21dfcdbaef38c632/dbs/java/trap/java ork/xom/xom/ivy/xercesImpl-2.12.2.jar:/home/REDACTED/work/xom/xom/build/classes:/home/REDACTED/work/commit rgo/bin/git (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Guard against potential NullPointerException when locator is null,
consistent with the parent class XOMHandler.startElement().

Agent-Logs-Url: https://github.com/elharo/xom/sessions/3a97536e-4907-4ab8-967e-7a5aa47f9112

Co-authored-by: elharo <1005544+elharo@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix potential NullPointerException in NonVerifyingHandler.startElement Add null check for locator in NonVerifyingHandler.startElement() Apr 15, 2026
Copilot AI requested a review from elharo April 15, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential NullPointerException in NonVerifyingHandler.startElement()

2 participants