commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skitch...@apache.org
Subject svn commit: r385707 - /jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java
Date Tue, 14 Mar 2006 01:49:10 GMT
Author: skitching
Date: Mon Mar 13 17:49:09 2006
New Revision: 385707

URL: http://svn.apache.org/viewcvs?rev=385707&view=rev
Log:
Fix incorrect detection of Xerces library. Checking the classpath is not enough,
as multiple XML parsers may be present.

Modified:
    jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java

Modified: jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java?rev=385707&r1=385706&r2=385707&view=diff
==============================================================================
--- jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java
(original)
+++ jakarta/commons/proper/digester/trunk/src/java/org/apache/commons/digester/ParserFeatureSetterFactory.java
Mon Mar 13 17:49:09 2006
@@ -37,7 +37,7 @@
  *
  * @since 1.6
  */
-public class ParserFeatureSetterFactory{
+public class ParserFeatureSetterFactory {
 
     /**
      * <code>true</code> is Xerces is used.
@@ -47,10 +47,14 @@
     static {
         try{
             // Use reflection to avoid a build dependency with Xerces.
-            Class versionClass = 
-                            Class.forName("org.apache.xerces.impl.Version");
-            isXercesUsed = true;
-        } catch (Exception ex){
+	    //
+	    // Note that this does not detect Sun's repackaging of 
+	    // Xerces as com.sun.org.apache.xerces; perhaps it should?
+	    SAXParserFactory factory = SAXParserFactory.newInstance();
+	    if (factory.getClass().getName().startsWith("org.apache.xerces")) {
+                isXercesUsed = true;
+	    }
+        } catch (Exception ex) {
             isXercesUsed = false;
         }
     }
@@ -74,4 +78,4 @@
         }
     }
 
-}
\ No newline at end of file
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message