public void setFeature(String name, boolean value)
throws ParserConfigurationException {
// If this is the secure processing feature, save it then return.
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
if (System.getSecurityManager() != null && (!value)) {
throw new ParserConfigurationException(
SAXMessageFormatter.formatMessage(null,
"jaxp-secureprocessing-feature", null));
}
fSecureProcess = value;
return;
}
if (features == null) {
features = new Hashtable();
}
features.put(name, value ? Boolean.TRUE : Boolean.FALSE);
// Test the feature by possibly throwing SAX exceptions
try {
new DocumentBuilderImpl(this, attributes, features);
}
catch (SAXNotSupportedException e) {
features.remove(name);
throw new ParserConfigurationException(e.getMessage());
}
catch (SAXNotRecognizedException e) {
features.remove(name);
throw new ParserConfigurationException(e.getMessage());
}
}