Stop comparing .jar names as toLowerCase();

update getClasspathInfo to catch exceptions with private worker method


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

View File

@ -83,11 +83,28 @@ public abstract class WhichJar // prevent instantiation; provide static service
*/
public static void getClasspathInfo(Hashtable hash, String options)
{
logProperty(hash, "java.class.path");
logProperty(hash, "sun.boot.class.path");
logProperty(hash, "java.ext.dirs");
}
hash.put("java.class.path", System.getProperty("java.class.path"));
hash.put("sun.boot.class.path",
System.getProperty("sun.boot.class.path"));
hash.put("java.ext.dirs", System.getProperty("java.ext.dirs"));
/**
* Worker method to print System.getProperty without
* putting nulls and catching exceptions.
*
* @param hash to put information in
* @param propName to log
*/
private static void logProperty(Hashtable hash, String propertyName)
{
try
{
hash.put(propertyName, System.getProperty(propertyName));
}
catch (Throwable t)
{
/* no-op: ignore */
}
}
/** SERVICE_NAME. */
@ -147,9 +164,7 @@ public abstract class WhichJar // prevent instantiation; provide static service
while (st.hasMoreTokens())
{
// Compare as lower case to avoid case problems
// NOTE: we are case-insensitive!
String jarURI = st.nextToken().toLowerCase();
String jarURI = st.nextToken();
// If a path entry contains our jarName, process it
if (jarURI.indexOf(jarName) > -1)
@ -229,7 +244,7 @@ public abstract class WhichJar // prevent instantiation; provide static service
// Search each dir and compile status
while (st.hasMoreTokens())
{
String dir = st.nextToken().toLowerCase();
String dir = st.nextToken();
retVal = Math.max(retVal, searchDir(hash, dir, jarName, options));
}