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:
parent
0c290f3c61
commit
cb396f3206
15
java/src/org/apache/env/WhichXerces.java
vendored
15
java/src/org/apache/env/WhichXerces.java
vendored
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user