Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8259980

CatalogResolverImpl.resolveResource should accept null systemID

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 11.0.9
    • xml
    • None

      Since CatalogResolverImpl implements org.w3c.dom.LSResourceResolver - https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/ls/LSResourceResolver.html, its resolveReference method should accept null value for systemId.

      LSResourceResolver.resolveResource - https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/ls/LSResourceResolver.html#resolveResource(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) - explicitly states:

      {quote}
      systemId - The system identifier, a URI reference [IETF RFC 2396], of the external resource being referenced, or null if no system identifier was supplied.
      {quote}

      but when null systemId is passed to CatalogResolverImpl.resolveResource(...), following NPE is being thrown:

      {noformat}
      Exception in thread "main" java.lang.NullPointerException: JAXP09020006: The argument 'systemId' can not be null.
      at java.xml/javax.xml.catalog.CatalogMessages.reportNPEOnNull(CatalogMessages.java:129)
      at java.xml/javax.xml.catalog.CatalogResolverImpl.resolveEntity(CatalogResolverImpl.java:70)
      at java.xml/javax.xml.catalog.CatalogResolverImpl.resolveResource(CatalogResolverImpl.java:244)
      at java.xml/com.sun.org.apache.xerces.internal.util.DOMEntityResolverWrapper.resolveEntity(DOMEntityResolverWrapper.java:118)
      ...
      {noformat}

      and that goes against the definition in LSResourceResolver.resolveResource(), see https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/ls/LSResourceResolver.html#resolveResource(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String).

      Let me know if test is needed for this.

            joehw Joe Wang
            ljungman Lukáš Jungmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: