Merge pull request #300 from mishako/xml-parser-feature-fix
Do not set unsupported XML parser features
This commit is contained in:
commit
3c681bd4ae
1 changed files with 12 additions and 6 deletions
|
@ -359,23 +359,29 @@ public class WireFeedInput {
|
|||
}
|
||||
|
||||
} catch (final JDOMException e) {
|
||||
throw new IllegalStateException("JDOM could not create a SAX parser");
|
||||
throw new IllegalStateException("JDOM could not create a SAX parser", e);
|
||||
}
|
||||
|
||||
saxBuilder.setExpandEntities(false);
|
||||
|
||||
|
||||
return saxBuilder;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void setFeature(SAXBuilder saxBuilder, XMLReader parser, String feature, boolean value) {
|
||||
try {
|
||||
if (isFeatureSupported(parser, feature, value)) {
|
||||
saxBuilder.setFeature(feature, value);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFeatureSupported(XMLReader parser, String feature, boolean value) {
|
||||
try {
|
||||
parser.setFeature(feature, value);
|
||||
return true;
|
||||
} catch (final SAXNotRecognizedException e) {
|
||||
// ignore
|
||||
return false;
|
||||
} catch (final SAXNotSupportedException e) {
|
||||
// ignore
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue