jfarcand 2004/09/15 12:20:15
Modified: catalina/src/share/org/apache/catalina/startup
DigesterFactory.java
Log:
Remove xerces specific workaround. The Digester is now able to find which parser it
uses and configure it appropriately (long time ago I did that in Digester but never
took the time to fix Tomcat).
Revision Changes Path
1.9 +5 -58
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/DigesterFactory.java
Index: DigesterFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/DigesterFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DigesterFactory.java 2 Sep 2004 14:20:22 -0000 1.8
+++ DigesterFactory.java 15 Sep 2004 19:20:15 -0000 1.9
@@ -76,22 +76,11 @@
digester.setValidating(xmlValidation);
digester.setUseContextClassLoader(true);
- String parserName =
- digester.getFactory().getClass().getName();
- if (parserName.indexOf("xerces")!=-1) {
- digester = patchXerces(digester);
+ if (xmlValidation || xmlNamespaceAware){
+ configureSchema(digester);
}
schemaResolver = new SchemaResolver(digester);
- if (xmlValidation) {
- // Xerces 2.3 and up has a special way to turn on validation
- // for both DTD and Schema
- if (parserName.indexOf("xerces")!=-1) {
- turnOnXercesValidation(digester);
- } else {
- turnOnValidation(digester);
- }
- }
registerLocalSchema();
digester.setEntityResolver(schemaResolver);
@@ -104,28 +93,6 @@
/**
- * Patch Xerces for backward compatibility.
- */
- private static Digester patchXerces(Digester digester){
- // This feature is needed for backward compatibility with old DDs
- // which used Java encoding names such as ISO8859_1 etc.
- // with Crimson (bug 4701993). By default, Xerces does not
- // support ISO8859_1.
- try{
- digester.setFeature(
- "http://apache.org/xml/features/allow-java-encodings", true);
- } catch(ParserConfigurationException e){
- // log("contextConfig.registerLocalSchema", e);
- } catch(SAXNotRecognizedException e){
- // log("contextConfig.registerLocalSchema", e);
- } catch(SAXNotSupportedException e){
- // log("contextConfig.registerLocalSchema", e);
- }
- return digester;
- }
-
-
- /**
* Utilities used to force the parser to use local schema, when available,
* instead of the <code>schemaLocation</code> XML element.
*/
@@ -186,35 +153,15 @@
/**
* Turn on DTD and/or validation (based on the parser implementation)
*/
- protected static void turnOnValidation(Digester digester){
+ protected static void configureSchema(Digester digester){
URL url = DigesterFactory.class
.getResource(Constants.WebSchemaResourcePath_24);
if(url == null) {
- log.error("Could not get url for " +
Constants.WebSchemaResourcePath_24);
+ log.error("Could not get url for "
+ + Constants.WebSchemaResourcePath_24);
} else {
digester.setSchema(url.toString());
- }
- }
-
-
- /**
- * Turn on schema AND DTD validation on Xerces parser.
- */
- protected static void turnOnXercesValidation(Digester digester){
- try{
- digester.setFeature(
- "http://apache.org/xml/features/validation/dynamic",
- true);
- digester.setFeature(
- "http://apache.org/xml/features/validation/schema",
- true);
- } catch(ParserConfigurationException e){
- // log("contextConfig.registerLocalSchema", e);
- } catch(SAXNotRecognizedException e){
- // log("contextConfig.registerLocalSchema", e);
- } catch(SAXNotSupportedException e){
- // log("contextConfig.registerLocalSchema", e);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]