--- old/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java 2016-09-01 15:07:57.119682012 -0700 +++ new/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java 2016-09-01 15:07:57.019677058 -0700 @@ -42,6 +42,9 @@ ORACLE_JAXP_PROPERTY_PREFIX + "enableExtensionFunctions"; public static final String SP_ENABLE_EXTENSION_FUNCTION = "javax.xml.enableExtensionFunctions"; + // This is the correct name by the spec + public static final String SP_ENABLE_EXTENSION_FUNCTION_SPEC = + "jdk.xml.enableExtensionFunctions"; public static final String CATALOG_FEATURES = "javax.xml.catalog.catalogFeatures"; public final static String PROPERTY_USE_CATALOG = XMLConstants.USE_CATALOG; @@ -49,11 +52,11 @@ public static enum XmlFeature { /** * Feature enableExtensionFunctions - * FSP: extension function is enforced by FSP. When FSP is on, entension + * FSP: extension function is enforced by FSP. When FSP is on, extension * function is disabled. */ ENABLE_EXTENSION_FUNCTION(ORACLE_ENABLE_EXTENSION_FUNCTION, - SP_ENABLE_EXTENSION_FUNCTION, true, false, true, true), + SP_ENABLE_EXTENSION_FUNCTION_SPEC, true, false, true, true), /** * The {@link javax.xml.XMLConstants.USE_CATALOG} feature. * FSP: USE_CATALOG is not enforced by FSP. @@ -149,6 +152,30 @@ } /** + * Maps old property names with the new ones. This map is used to keep track of + * name changes so that old or incorrect names continue to be supported for compatibility. + */ + public static enum NameMap { + + ENABLE_EXTENSION_FUNCTION(SP_ENABLE_EXTENSION_FUNCTION_SPEC, SP_ENABLE_EXTENSION_FUNCTION); + + final String newName; + final String oldName; + + NameMap(String newName, String oldName) { + this.newName = newName; + this.oldName = oldName; + } + + String getOldName(String newName) { + if (newName.equals(this.newName)) { + return oldName; + } + return null; + } + } + + /** * States of the settings of a property, in the order: default value, value * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system * properties, and jaxp api properties @@ -316,6 +343,15 @@ private void readSystemProperties() { for (XmlFeature feature : XmlFeature.values()) { getSystemProperty(feature, feature.systemProperty()); + if (!getSystemProperty(feature, feature.systemProperty())) { + //if system property is not found, try the older form if any + for (NameMap nameMap : NameMap.values()) { + String oldName = nameMap.getOldName(feature.systemProperty()); + if (oldName != null) { + getSystemProperty(feature, oldName); + } + } + } } }