186 187 public static final String XML_SECURITY_PROPERTY_MANAGER = 188 ORACLE_JAXP_PROPERTY_PREFIX + "xmlSecurityPropertyManager"; 189 190 //System Properties corresponding to ACCESS_EXTERNAL_* properties 191 public static final String SP_ACCESS_EXTERNAL_DTD = "javax.xml.accessExternalDTD"; 192 public static final String SP_ACCESS_EXTERNAL_SCHEMA = "javax.xml.accessExternalSchema"; 193 //all access keyword 194 public static final String ACCESS_EXTERNAL_ALL = "all"; 195 196 /** 197 * Default value when FEATURE_SECURE_PROCESSING (FSP) is set to true 198 */ 199 public static final String EXTERNAL_ACCESS_DEFAULT_FSP = ""; 200 201 /** 202 * FEATURE_SECURE_PROCESSING (FSP) is true by default 203 */ 204 public static final String EXTERNAL_ACCESS_DEFAULT = ACCESS_EXTERNAL_ALL; 205 206 /** 207 * Check if we're in jdk8 or above 208 */ 209 public static final boolean IS_JDK8_OR_ABOVE = isJavaVersionAtLeast(8); 210 211 // 212 // Implementation limits: corresponding System Properties of the above 213 // API properties 214 // 215 /** 216 * JDK entity expansion limit; Note that the existing system property 217 * "entityExpansionLimit" with no prefix is still observed 218 */ 219 public static final String JDK_ENTITY_EXPANSION_LIMIT = 220 ORACLE_JAXP_PROPERTY_PREFIX + "entityExpansionLimit"; 221 222 /** 223 * JDK element attribute limit; Note that the existing system property 224 * "elementAttributeLimit" with no prefix is still observed 225 */ 226 public static final String JDK_ELEMENT_ATTRIBUTE_LIMIT = 227 ORACLE_JAXP_PROPERTY_PREFIX + "elementAttributeLimit"; 228 229 /** 230 * JDK maxOccur limit; Note that the existing system property 838 839 /** Returns an enumeration of the SAX properties. */ 840 public static Enumeration getSAXProperties() { 841 return fgSAXProperties.length > 0 842 ? new ArrayEnumeration(fgSAXProperties) : fgEmptyEnumeration; 843 } // getSAXProperties():Enumeration 844 845 // xerces 846 847 /** Returns an enumeration of the Xerces features. */ 848 public static Enumeration getXercesFeatures() { 849 return fgXercesFeatures.length > 0 850 ? new ArrayEnumeration(fgXercesFeatures) : fgEmptyEnumeration; 851 } // getXercesFeatures():Enumeration 852 853 /** Returns an enumeration of the Xerces properties. */ 854 public static Enumeration getXercesProperties() { 855 return fgXercesProperties.length > 0 856 ? new ArrayEnumeration(fgXercesProperties) : fgEmptyEnumeration; 857 } // getXercesProperties():Enumeration 858 859 /* 860 * Check the major version of the current JDK against that specified 861 * in the parameter 862 * 863 * In JDK9 the java version string was changed to comply with JEP-223 864 * so this method was modified to handle that new format as well 865 * 866 * @param compareTo a JDK major version to be compared to 867 * @return true if the current major version is the same or above 868 * that represented by the parameter 869 */ 870 public static boolean isJavaVersionAtLeast(int compareTo) { 871 String javaVersion = SecuritySupport.getSystemProperty("java.version"); 872 javaVersion = (javaVersion.matches("[1-9][0-9]*(\\.(0|[1-9][0-9]*))*\\-.*")) ? 873 javaVersion.split("-|\\.")[0] : 874 javaVersion.split("\\.", 3)[1]; 875 return Integer.parseInt(javaVersion) >= compareTo; 876 } 877 878 // 879 // Classes 880 // 881 882 /** 883 * An array enumeration. 884 * 885 * @author Andy Clark, IBM 886 */ 887 static class ArrayEnumeration 888 implements Enumeration { 889 890 // 891 // Data 892 // 893 894 /** Array. */ 895 private Object[] array; 896 | 186 187 public static final String XML_SECURITY_PROPERTY_MANAGER = 188 ORACLE_JAXP_PROPERTY_PREFIX + "xmlSecurityPropertyManager"; 189 190 //System Properties corresponding to ACCESS_EXTERNAL_* properties 191 public static final String SP_ACCESS_EXTERNAL_DTD = "javax.xml.accessExternalDTD"; 192 public static final String SP_ACCESS_EXTERNAL_SCHEMA = "javax.xml.accessExternalSchema"; 193 //all access keyword 194 public static final String ACCESS_EXTERNAL_ALL = "all"; 195 196 /** 197 * Default value when FEATURE_SECURE_PROCESSING (FSP) is set to true 198 */ 199 public static final String EXTERNAL_ACCESS_DEFAULT_FSP = ""; 200 201 /** 202 * FEATURE_SECURE_PROCESSING (FSP) is true by default 203 */ 204 public static final String EXTERNAL_ACCESS_DEFAULT = ACCESS_EXTERNAL_ALL; 205 206 // 207 // Implementation limits: corresponding System Properties of the above 208 // API properties 209 // 210 /** 211 * JDK entity expansion limit; Note that the existing system property 212 * "entityExpansionLimit" with no prefix is still observed 213 */ 214 public static final String JDK_ENTITY_EXPANSION_LIMIT = 215 ORACLE_JAXP_PROPERTY_PREFIX + "entityExpansionLimit"; 216 217 /** 218 * JDK element attribute limit; Note that the existing system property 219 * "elementAttributeLimit" with no prefix is still observed 220 */ 221 public static final String JDK_ELEMENT_ATTRIBUTE_LIMIT = 222 ORACLE_JAXP_PROPERTY_PREFIX + "elementAttributeLimit"; 223 224 /** 225 * JDK maxOccur limit; Note that the existing system property 833 834 /** Returns an enumeration of the SAX properties. */ 835 public static Enumeration getSAXProperties() { 836 return fgSAXProperties.length > 0 837 ? new ArrayEnumeration(fgSAXProperties) : fgEmptyEnumeration; 838 } // getSAXProperties():Enumeration 839 840 // xerces 841 842 /** Returns an enumeration of the Xerces features. */ 843 public static Enumeration getXercesFeatures() { 844 return fgXercesFeatures.length > 0 845 ? new ArrayEnumeration(fgXercesFeatures) : fgEmptyEnumeration; 846 } // getXercesFeatures():Enumeration 847 848 /** Returns an enumeration of the Xerces properties. */ 849 public static Enumeration getXercesProperties() { 850 return fgXercesProperties.length > 0 851 ? new ArrayEnumeration(fgXercesProperties) : fgEmptyEnumeration; 852 } // getXercesProperties():Enumeration 853 854 // 855 // Classes 856 // 857 858 /** 859 * An array enumeration. 860 * 861 * @author Andy Clark, IBM 862 */ 863 static class ArrayEnumeration 864 implements Enumeration { 865 866 // 867 // Data 868 // 869 870 /** Array. */ 871 private Object[] array; 872 |