Skip to content
Browse files

Handle UnsupportedOperationException when creating XSDVALIDATING.

The SAXParserFactory throws an UnsupportedOperationException when setSchema
is called. Therefore every factory throws this exception unless it overrides
setSchema. A popular example is Apache Xerces SAXParserFactoryImpl before
version 2.7.0.
  • Loading branch information...
1 parent 8c92811 commit f43ba50e522199568c932f5ac6e987a9fa19a99e @stefanbirkner committed Sep 27, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 core/src/java/org/jdom2/input/sax/XMLReaders.java
View
6 core/src/java/org/jdom2/input/sax/XMLReaders.java
@@ -128,6 +128,12 @@ private XMLReaders(int validate) {
// this system does not support XSD Validation.... which is true for android!
// we could not get a validating system, set the fac to null
fac = null;
+ } catch (UnsupportedOperationException uoe) {
+ // SAXParserFactory throws this exception when setSchema is called.
+ // Therefore every factory throws this exception unless it overrides
+ // setSchema. A popular example is Apache Xerces SAXParserFactoryImpl
+ // before version 2.7.0.
+ fac = null;
}
break;
}

0 comments on commit f43ba50

Please sign in to comment.
Something went wrong with that request. Please try again.