src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java

Print this page




 410         }
 411         if (name.startsWith(JAXP_SOURCE_FEATURE_PREFIX)) {
 412             if (name.equals(StreamSource.FEATURE) ||
 413                 name.equals(SAXSource.FEATURE) ||
 414                 name.equals(DOMSource.FEATURE) ||
 415                 name.equals(StAXSource.FEATURE)) {
 416                 throw new SAXNotSupportedException(
 417                         SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
 418                         "feature-read-only", new Object [] {name}));
 419             }
 420         }
 421         if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
 422             if (System.getSecurityManager() != null && (!value)) {
 423                 throw new SAXNotSupportedException(
 424                         SAXMessageFormatter.formatMessage(null,
 425                         "jaxp-secureprocessing-feature", null));
 426             }
 427 
 428             fSecurityManager.setSecureProcessing(value);
 429             if (value) {
 430                 if (Constants.IS_JDK8_OR_ABOVE) {
 431                     fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
 432                             XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
 433                     fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
 434                             XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
 435                 }
 436             }
 437 
 438             fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
 439             return;
 440         }
 441         else if (name.equals(USE_GRAMMAR_POOL_ONLY)) {
 442             fUseGrammarPoolOnly = value;
 443             return;
 444         }
 445         else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
 446             //in secure mode, let _useServicesMechanism be determined by the constructor
 447             if (System.getSecurityManager() != null)
 448                 return;
 449         }
 450         try {
 451             fXMLSchemaLoader.setFeature(name, value);
 452         }
 453         catch (XMLConfigurationException e) {
 454             String identifier = e.getIdentifier();
 455             if (e.getType() == Status.NOT_RECOGNIZED) {




 410         }
 411         if (name.startsWith(JAXP_SOURCE_FEATURE_PREFIX)) {
 412             if (name.equals(StreamSource.FEATURE) ||
 413                 name.equals(SAXSource.FEATURE) ||
 414                 name.equals(DOMSource.FEATURE) ||
 415                 name.equals(StAXSource.FEATURE)) {
 416                 throw new SAXNotSupportedException(
 417                         SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
 418                         "feature-read-only", new Object [] {name}));
 419             }
 420         }
 421         if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
 422             if (System.getSecurityManager() != null && (!value)) {
 423                 throw new SAXNotSupportedException(
 424                         SAXMessageFormatter.formatMessage(null,
 425                         "jaxp-secureprocessing-feature", null));
 426             }
 427 
 428             fSecurityManager.setSecureProcessing(value);
 429             if (value) {

 430                 fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
 431                         XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
 432                 fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
 433                         XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);

 434             }
 435 
 436             fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
 437             return;
 438         }
 439         else if (name.equals(USE_GRAMMAR_POOL_ONLY)) {
 440             fUseGrammarPoolOnly = value;
 441             return;
 442         }
 443         else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
 444             //in secure mode, let _useServicesMechanism be determined by the constructor
 445             if (System.getSecurityManager() != null)
 446                 return;
 447         }
 448         try {
 449             fXMLSchemaLoader.setFeature(name, value);
 450         }
 451         catch (XMLConfigurationException e) {
 452             String identifier = e.getIdentifier();
 453             if (e.getType() == Status.NOT_RECOGNIZED) {