347 * @exception XMLConfigurationException If the requested feature is not known.
348 */
349 public void setFeature(String featureId, boolean value) throws XMLConfigurationException {
350 if (PARSER_SETTINGS.equals(featureId)) {
351 throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
352 }
353 else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
354 throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
355 }
356 else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
357 throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
358 }
359 if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
360 if (_isSecureMode && !value) {
361 throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
362 }
363
364 fInitSecurityManager.setSecureProcessing(value);
365 setProperty(SECURITY_MANAGER, fInitSecurityManager);
366
367 if (value && Constants.IS_JDK8_OR_ABOVE) {
368 fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
369 XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
370 fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
371 XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
372 setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
373 }
374
375 return;
376 }
377 fConfigUpdated = true;
378 fEntityManager.setFeature(featureId, value);
379 fErrorReporter.setFeature(featureId, value);
380 fSchemaValidator.setFeature(featureId, value);
381 if (!fInitFeatures.containsKey(featureId)) {
382 boolean current = super.getFeature(featureId);
383 fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
384 }
385 super.setFeature(featureId, value);
386 }
387
|
347 * @exception XMLConfigurationException If the requested feature is not known.
348 */
349 public void setFeature(String featureId, boolean value) throws XMLConfigurationException {
350 if (PARSER_SETTINGS.equals(featureId)) {
351 throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
352 }
353 else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
354 throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
355 }
356 else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
357 throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
358 }
359 if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
360 if (_isSecureMode && !value) {
361 throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
362 }
363
364 fInitSecurityManager.setSecureProcessing(value);
365 setProperty(SECURITY_MANAGER, fInitSecurityManager);
366
367 if (value) {
368 fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
369 XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
370 fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
371 XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
372 setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
373 }
374
375 return;
376 }
377 fConfigUpdated = true;
378 fEntityManager.setFeature(featureId, value);
379 fErrorReporter.setFeature(featureId, value);
380 fSchemaValidator.setFeature(featureId, value);
381 if (!fInitFeatures.containsKey(featureId)) {
382 boolean current = super.getFeature(featureId);
383 fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
384 }
385 super.setFeature(featureId, value);
386 }
387
|