Look for EITHER a Xerces 1.x jar or a 2.x jar; look for either xerces.jar or xercesImpl.jar

git-svn-id: https://svn.apache.org/repos/asf/xml/commons/trunk@225983 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
curcuru 2002-06-20 19:59:55 +00:00
parent 0c290f3c61
commit cb396f3206

View File

@ -75,6 +75,9 @@ public class WhichXerces implements WhichProject
/** The Xerces-J implementation jar. */ /** The Xerces-J implementation jar. */
private static final String XERCES_JARNAME = "xerces.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. */ /** The Xerces-J 2.x xmlParserAPIs jar. */
private static final String PARSERAPIS_JARNAME = "xmlParserAPIs.jar"; private static final String PARSERAPIS_JARNAME = "xmlParserAPIs.jar";
@ -153,12 +156,20 @@ public class WhichXerces implements WhichProject
xerces2found = WhichConstant.ITEM_NOTFOUND; 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, int jarRetVal = WhichJar.searchClasspaths(hash, XERCES_JARNAME,
options); options);
jarRetVal = Math.min(jarRetVal, WhichJar.searchClasspaths(
hash, XERCESIMPL_JARNAME, options));
int ignoreThisReturnValue = WhichJar.searchClasspaths(hash, int ignoreThisReturnValue = WhichJar.searchClasspaths(hash,
PARSERAPIS_JARNAME, options); 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);
} }
} }