private Class<?> findClassInComponents(final String name) throws ClassNotFoundException {
   final String classFilename = this.getClassFilename(name);
   final Enumeration<File> e = this.pathComponents.elements();
   while (e.hasMoreElements()) {
     final File pathComponent = e.nextElement();
     InputStream stream = null;
     try {
       stream = this.getResourceStream(pathComponent, classFilename);
       if (stream != null) {
         this.log("Loaded from " + pathComponent + " " + classFilename, 4);
         return this.getClassFromStream(stream, name, pathComponent);
       }
       continue;
     } catch (SecurityException se) {
       throw se;
     } catch (IOException ioe) {
       this.log(
           "Exception reading component " + pathComponent + " (reason: " + ioe.getMessage() + ")",
           3);
     } finally {
       FileUtils.close(stream);
     }
   }
   throw new ClassNotFoundException(name);
 }
 public URL getResource(final String name) {
   URL url = null;
   if (this.isParentFirst(name)) {
     url = ((this.parent == null) ? super.getResource(name) : this.parent.getResource(name));
   }
   if (url != null) {
     this.log("Resource " + name + " loaded from parent loader", 4);
   } else {
     final Enumeration<File> e = this.pathComponents.elements();
     while (e.hasMoreElements() && url == null) {
       final File pathComponent = e.nextElement();
       url = this.getResourceURL(pathComponent, name);
       if (url != null) {
         this.log("Resource " + name + " loaded from ant loader", 4);
       }
     }
   }
   if (url == null && !this.isParentFirst(name)) {
     if (this.ignoreBase) {
       url = ((this.getRootLoader() == null) ? null : this.getRootLoader().getResource(name));
     } else {
       url = ((this.parent == null) ? super.getResource(name) : this.parent.getResource(name));
     }
     if (url != null) {
       this.log("Resource " + name + " loaded from parent loader", 4);
     }
   }
   if (url == null) {
     this.log("Couldn't load Resource " + name, 4);
   }
   return url;
 }
 public void addJavaLibraries() {
   final Vector<String> packages = JavaEnvUtils.getJrePackages();
   final Enumeration<String> e = packages.elements();
   while (e.hasMoreElements()) {
     final String packageName = e.nextElement();
     this.addSystemPackageRoot(packageName);
   }
 }
 private InputStream loadResource(final String name) {
   InputStream stream = null;
   File pathComponent;
   for (Enumeration<File> e = this.pathComponents.elements();
       e.hasMoreElements() && stream == null;
       stream = this.getResourceStream(pathComponent, name)) {
     pathComponent = e.nextElement();
   }
   return stream;
 }
 private boolean isParentFirst(final String resourceName) {
   boolean useParentFirst = this.parentFirst;
   Enumeration<String> e = this.systemPackages.elements();
   while (e.hasMoreElements()) {
     final String packageName = e.nextElement();
     if (resourceName.startsWith(packageName)) {
       useParentFirst = true;
       break;
     }
   }
   e = this.loaderPackages.elements();
   while (e.hasMoreElements()) {
     final String packageName = e.nextElement();
     if (resourceName.startsWith(packageName)) {
       useParentFirst = false;
       break;
     }
   }
   return useParentFirst;
 }
 public String getClasspath() {
   final StringBuilder sb = new StringBuilder();
   boolean firstPass = true;
   final Enumeration<File> componentEnum = this.pathComponents.elements();
   while (componentEnum.hasMoreElements()) {
     if (!firstPass) {
       sb.append(System.getProperty("path.separator"));
     } else {
       firstPass = false;
     }
     sb.append(componentEnum.nextElement().getAbsolutePath());
   }
   return sb.toString();
 }
 public synchronized void cleanup() {
   final Enumeration<JarFile> e = this.jarFiles.elements();
   while (e.hasMoreElements()) {
     final JarFile jarFile = e.nextElement();
     try {
       jarFile.close();
     } catch (IOException ex) {
     }
   }
   this.jarFiles = new Hashtable<File, JarFile>();
   if (this.project != null) {
     this.project.removeBuildListener(this);
   }
   this.project = null;
 }