Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8174384 | 10 | Daniel Fuchs | P2 | Resolved | Fixed | b01 |
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}
{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}
- backported by
-
JDK-8174384 CatalogManager.catalogResolver should not fail when non-existing URI is passed to it
- Resolved