if (classLoader == null) {
return (null);
}
// Set up the Jasper class loader
StandardClassLoader newLoader = new StandardClassLoader(classLoader);
File directory = new File(System.getProperty("catalina.home"),
"jasper");
if (directory.exists() && directory.canRead() &&
directory.isDirectory()) {
String filenames[] = directory.list();
for (int i = 0; i < filenames.length; i++) {
if (!filenames[i].endsWith(".jar"))
continue;
File file = new File(directory, filenames[i]);
try {
URL url = new URL("file", null, file.getCanonicalPath());
newLoader.addRepository(url.toString());
} catch (IOException e) {
throw new IllegalArgumentException(e.toString());
}
}
}