diff --git a/java/src/org/apache/env/WhichXerces.java b/java/src/org/apache/env/WhichXerces.java index 6d6e5e1..333f019 100644 --- a/java/src/org/apache/env/WhichXerces.java +++ b/java/src/org/apache/env/WhichXerces.java @@ -75,6 +75,9 @@ public class WhichXerces implements WhichProject /** 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 @@ public class WhichXerces implements WhichProject 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); } }