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

CatalogManager.catalogResolver should not fail when non-existing URI is passed to it

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 9
    • 9
    • xml
    • None
    • b153
    • 9
    • b155
    • generic
    • generic
    • Verified

        say I have following line of code:

        {code}
        CatalogManager.catalogResolver(CatalogFeatures.defaults(), URI.create(new File("/tmp/xxx.xml").toURI().toURL().toExternalForm()));
        {code}

        and let {{new File("/tmp/xxx.xml").exists() == false}}

        actual behaviour of the code when executed is that it throws following exception:
        {code}
        Exception in thread "main" java.lang.IllegalArgumentException: The specified URI 'file:/tmp/xxx.xml' is not a valid URL.
        at java.xml/javax.xml.catalog.CatalogMessages.reportIAE(CatalogMessages.java:140)
        at java.xml/javax.xml.catalog.Util.validateUriSyntax(Util.java:156)
        at java.xml/javax.xml.catalog.Util.validateUrisSyntax(Util.java:117)
        at java.xml/javax.xml.catalog.CatalogManager.catalog(CatalogManager.java:71)
        at java.xml/javax.xml.catalog.CatalogManager.catalogResolver(CatalogManager.java:119)
        at javaapplication3.JavaApplication3.main(JavaApplication3.java:28)
        {code}

        expected behaviour is that no exception is thrown and this particular catalog entry is ignored as is defined in a javadoc of the CatalogManager.catalogResolver method and referenced OASIS standard which explicitly states that
        {quote}
        If the processor attempts to load a resource and fails (because the resource does not exist or is not reachable, for example), it must recover by ignoring the catalog entry file that failed and proceeding.
        {quote}

              dfuchs Daniel Fuchs
              ljungman Lukáš Jungmann
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: