8320918: Fix errors in the built-in Catalog implementation
Reviewed-by: lancea, naoto, iris
This commit is contained in:
parent
5e1b771a19
commit
9a6ca233c7
@ -304,7 +304,7 @@ public final class JdkConstants {
|
|||||||
* System Property for the JDKCatalog' RESOLVE property
|
* System Property for the JDKCatalog' RESOLVE property
|
||||||
* @since 22
|
* @since 22
|
||||||
*/
|
*/
|
||||||
public static final String JDKCATALOG_RESOLVE = "jdk.xml.jdkCatalog.resolve";
|
public static final String JDKCATALOG_RESOLVE = "jdk.xml.jdkcatalog.resolve";
|
||||||
|
|
||||||
// Catalog Resolve Integer mappings for String values
|
// Catalog Resolve Integer mappings for String values
|
||||||
public static final int CONTINUE = 0;
|
public static final int CONTINUE = 0;
|
||||||
|
@ -47,11 +47,11 @@
|
|||||||
# the default property values. The format is:
|
# the default property values. The format is:
|
||||||
# system-property-name=value
|
# system-property-name=value
|
||||||
#
|
#
|
||||||
# For example, the FILES property in CatalogFeatures has an associated system
|
# For example, the RESOLVE property in CatalogFeatures has an associated system
|
||||||
# property called javax.xml.catalog.files. An entry for the FILES property in the
|
# property called javax.xml.catalog.resolve. An entry for the RESOLVE property in the
|
||||||
# configuration file would therefore use javax.xml.catalog.files as the key, that
|
# configuration file would therefore use javax.xml.catalog.resolve as the key, that
|
||||||
# is:
|
# is:
|
||||||
# javax.xml.catalog.files=strict
|
# javax.xml.catalog.resolve=strict
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Extension Functions:
|
# Extension Functions:
|
||||||
@ -128,6 +128,24 @@ jdk.xml.overrideDefaultParser=false
|
|||||||
#
|
#
|
||||||
# javax.xml.useCatalog=true
|
# javax.xml.useCatalog=true
|
||||||
#
|
#
|
||||||
|
# Implementation Specific Properties - jdkcatalog.resolve
|
||||||
|
#
|
||||||
|
# This property instructs the JDK default CatalogResolver to act in accordance with
|
||||||
|
# the setting when unable to resolve an external reference with the built-in Catalog.
|
||||||
|
# The options are:
|
||||||
|
# continue -- indicates that the processing should continue
|
||||||
|
# ignore -- indicates that the reference is skipped
|
||||||
|
# strict -- indicates that the resolver should throw a CatalogException
|
||||||
|
#
|
||||||
|
# The following setting would cause the resolve to throw a CatalogException when
|
||||||
|
# unable to resolve an external reference:
|
||||||
|
# jdk.xml.jdkcatalog.resolve=strict
|
||||||
|
#
|
||||||
|
# Implementation Specific Properties - DTD
|
||||||
|
#
|
||||||
|
# This property instructs the parsers to: deny, ignore or allow DTD processing.
|
||||||
|
# The following setting would cause the parser to reject DTD by throwing an exception.
|
||||||
|
# jdk.xml.dtd.support=deny
|
||||||
#
|
#
|
||||||
# Implementation Specific Properties - Limits
|
# Implementation Specific Properties - Limits
|
||||||
#
|
#
|
||||||
|
@ -57,7 +57,7 @@ public class CatalogTestBase extends TestBase {
|
|||||||
|
|
||||||
// error (not from catalog) is expect when CATALOG=continue
|
// error (not from catalog) is expect when CATALOG=continue
|
||||||
boolean isErrExpected = true;
|
boolean isErrExpected = true;
|
||||||
String expected1 = "invalid.site.com";
|
String expected1 = UNKNOWN_HOST;
|
||||||
|
|
||||||
// expected when reference is resolved by Catalog
|
// expected when reference is resolved by Catalog
|
||||||
String expected3 = "", expected4 = "";
|
String expected3 = "", expected4 = "";
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# ---- Config File: for testing the CATALOG property ----
|
# ---- Config File: for testing the CATALOG property ----
|
||||||
#
|
#
|
||||||
# strict: report error if not resolved by the JDK Catalog
|
# strict: report error if not resolved by the JDK Catalog
|
||||||
jdk.xml.jdkCatalog.resolve=strict
|
jdk.xml.jdkcatalog.resolve=strict
|
||||||
# Enable Extension Functions
|
# Enable Extension Functions
|
||||||
jdk.xml.enableExtensionFunctions=true
|
jdk.xml.enableExtensionFunctions=true
|
||||||
# Disallow overriding the default parser
|
# Disallow overriding the default parser
|
||||||
|
@ -47,11 +47,11 @@
|
|||||||
# the default property values. The format is:
|
# the default property values. The format is:
|
||||||
# system-property-name=value
|
# system-property-name=value
|
||||||
#
|
#
|
||||||
# For example, the FILES property in CatalogFeatures has an associated system
|
# For example, the RESOLVE property in CatalogFeatures has an associated system
|
||||||
# property called javax.xml.catalog.files. An entry for the FILES property in the
|
# property called javax.xml.catalog.resolve. An entry for the RESOLVE property in the
|
||||||
# configuration file would therefore use javax.xml.catalog.files as the key, that
|
# configuration file would therefore use javax.xml.catalog.resolve as the key, that
|
||||||
# is:
|
# is:
|
||||||
# javax.xml.catalog.files=strict
|
# javax.xml.catalog.resolve=strict
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Extension Functions:
|
# Extension Functions:
|
||||||
@ -128,6 +128,19 @@ jdk.xml.overrideDefaultParser=false
|
|||||||
#
|
#
|
||||||
# javax.xml.useCatalog=true
|
# javax.xml.useCatalog=true
|
||||||
#
|
#
|
||||||
|
# Implementation Specific Properties - jdkcatalog.resolve
|
||||||
|
#
|
||||||
|
# This property instructs the JDK default CatalogResolver to act in accordance with
|
||||||
|
# the setting when unable to resolve an external reference with the built-in Catalog.
|
||||||
|
# The options are:
|
||||||
|
# continue -- indicates that the processing should continue
|
||||||
|
# ignore -- indicates that the reference is skipped
|
||||||
|
# strict -- indicates that the resolver should throw a CatalogException
|
||||||
|
#
|
||||||
|
# The following setting would cause the resolve to throw a CatalogException when
|
||||||
|
# unable to resolve an external reference:
|
||||||
|
# jdk.xml.jdkcatalog.resolve=strict
|
||||||
|
#
|
||||||
# Implementation Specific Properties - DTD
|
# Implementation Specific Properties - DTD
|
||||||
#
|
#
|
||||||
# This property instructs the parsers to: deny, ignore or allow DTD processing.
|
# This property instructs the parsers to: deny, ignore or allow DTD processing.
|
||||||
|
@ -102,7 +102,7 @@ public class TestBase {
|
|||||||
|
|
||||||
// Impl Specific Properties
|
// Impl Specific Properties
|
||||||
public static final String SP_DTD = "jdk.xml.dtd.support";
|
public static final String SP_DTD = "jdk.xml.dtd.support";
|
||||||
public static final String SP_CATALOG = "jdk.xml.jdkCatalog.resolve";
|
public static final String SP_CATALOG = "jdk.xml.jdkcatalog.resolve";
|
||||||
public static final String OVERRIDE_PARSER = "jdk.xml.overrideDefaultParser";
|
public static final String OVERRIDE_PARSER = "jdk.xml.overrideDefaultParser";
|
||||||
|
|
||||||
// DTD/CATALOG constants
|
// DTD/CATALOG constants
|
||||||
@ -121,6 +121,7 @@ public class TestBase {
|
|||||||
// CATALOG=strict
|
// CATALOG=strict
|
||||||
public static final String CONFIG_CATALOG_STRICT = "catalog2.properties";
|
public static final String CONFIG_CATALOG_STRICT = "catalog2.properties";
|
||||||
|
|
||||||
|
public static final String UNKNOWN_HOST = "invalid.site.com";
|
||||||
|
|
||||||
String xmlExternalEntity, xmlExternalEntityId;
|
String xmlExternalEntity, xmlExternalEntityId;
|
||||||
String xmlGE_Expansion, xmlGE_ExpansionId;
|
String xmlGE_Expansion, xmlGE_ExpansionId;
|
||||||
@ -334,17 +335,19 @@ public class TestBase {
|
|||||||
|
|
||||||
protected void processError(boolean expectError, String error, Exception e)
|
protected void processError(boolean expectError, String error, Exception e)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
//e.printStackTrace();
|
|
||||||
String str = e.getMessage();
|
String str = e.getMessage();
|
||||||
// System.out.println("Exp Msg: " + str);
|
|
||||||
//e.printStackTrace();
|
|
||||||
if (!expectError) {
|
if (!expectError) {
|
||||||
Assert.assertTrue(false, "Expected pass, but Exception is thrown " +
|
Assert.assertTrue(false, "Expected pass, but Exception is thrown " + str);
|
||||||
str);
|
} else {
|
||||||
|
// This check is necessary since errors other than UnknownHostException
|
||||||
|
// can contain the host name in the System ID
|
||||||
|
if (UNKNOWN_HOST.equals(error)) {
|
||||||
|
Assert.assertTrue((str != null) && str.equals(error));
|
||||||
} else {
|
} else {
|
||||||
Assert.assertTrue((str != null) && str.contains(error));
|
Assert.assertTrue((str != null) && str.contains(error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a DocumentBuilderFactory with settings as specified.
|
* Returns a DocumentBuilderFactory with settings as specified.
|
||||||
|
Loading…
Reference in New Issue
Block a user