} else if (loc2.exists()) {
loc = loc2;
}
if (loc != null) {
found = true;
ICodeBaseLocator codeBaseLocator = classFactory.createFilesystemCodeBaseLocator(loc.getPath());
workList.add(new WorkListItem(codeBaseLocator, false, ICodeBase.Discovered.IN_SYSTEM_CLASSPATH));
}
}
if (!found) {
if (DEBUG) {
System.out.println("Looking for " + jarFileName + " on classpath...");
}
//
// See if the required jar file is available on the class path.
//
String javaClassPath = SystemProperties.getProperty("java.class.path");
StringTokenizer t = new StringTokenizer(javaClassPath, File.pathSeparator);
while (t.hasMoreTokens()) {
String entry = t.nextToken();
if (DEBUG) {
System.out.print(" Checking " + entry + "...");
}
if (matchesJarFile(entry, jarFileName)) {
found = true;
} else if (matchesJarFile(entry, "findbugs.jar")) {
// See if the searched-for jar file can be found
// alongside findbugs.jar.
File findbugsJar = new File(entry);
File loc = new File(findbugsJar.getParent() + File.separator + jarFileName);
if (DEBUG) {
System.out.print(" [findbugs.jar, checking " + loc.getPath() + "] ");
}
if (loc.exists()) {
entry = loc.getPath();
found = true;
}
}
if (DEBUG) {
System.out.println(found ? "FOUND" : "no");
}
if (found) {
ICodeBaseLocator codeBaseLocator = classFactory.createFilesystemCodeBaseLocator(entry);
workList.add(new WorkListItem(codeBaseLocator, false, ICodeBase.Discovered.IN_SYSTEM_CLASSPATH));
break;
}
}