From cb396f3206da7aa0b9f7dad6fd7d39d94760b182 Mon Sep 17 00:00:00 2001 From: curcuru Date: Thu, 20 Jun 2002 19:59:55 +0000 Subject: [PATCH] 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 --- java/src/org/apache/env/WhichXerces.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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); } }