You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-cvs@xml.apache.org by cu...@apache.org on 2002/06/20 21:59:55 UTC
cvs commit: xml-commons/java/src/org/apache/env WhichXerces.java
curcuru 2002/06/20 12:59:55
Modified: java/src/org/apache/env WhichXerces.java
Log:
Look for EITHER a Xerces 1.x jar or a 2.x jar; look for either xerces.jar or xercesImpl.jar
Revision Changes Path
1.2 +14 -3 xml-commons/java/src/org/apache/env/WhichXerces.java
Index: WhichXerces.java
===================================================================
RCS file: /home/cvs/xml-commons/java/src/org/apache/env/WhichXerces.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WhichXerces.java 11 Dec 2001 17:42:50 -0000 1.1
+++ WhichXerces.java 20 Jun 2002 19:59:55 -0000 1.2
@@ -75,6 +75,9 @@
/** The Xerces-J implementation jar. */
private static final String XERCES_JARNAME = "xerces.jar";
+ /** The new Xerces-J implementation jar. */
+ private static final String XERCESIMPL_JARNAME = "xercesImpl.jar";
+
/** The Xerces-J 2.x xmlParserAPIs jar. */
private static final String PARSERAPIS_JARNAME = "xmlParserAPIs.jar";
@@ -153,12 +156,20 @@
xerces2found = WhichConstant.ITEM_NOTFOUND;
}
- // Try to find xerces.jar in the classpath, etc.
+ // Try to find EITHER xerces.jar OR xercesImpl.jar in
+ // the classpath - take the min() of these, since
+ // if we find either one it should be OK
int jarRetVal = WhichJar.searchClasspaths(hash, XERCES_JARNAME,
options);
+ jarRetVal = Math.min(jarRetVal, WhichJar.searchClasspaths(
+ hash, XERCESIMPL_JARNAME, options));
+
int ignoreThisReturnValue = WhichJar.searchClasspaths(hash,
PARSERAPIS_JARNAME, options);
- return Math.max(jarRetVal, Math.max(xerces1found, xerces1found));
+ // Report OK if either version of xerces was found
+ int anyXercesFound = Math.min(xerces1found, xerces2found);
+
+ return Math.max(jarRetVal, anyXercesFound);
}
}