Example #1
0
 @Override
 public Enumeration<URL> getResources(String name) throws IOException {
   final HashSet<URL> urls = new HashSet<>();
   for (ClassLoader cl : parents) {
     urls.addAll(Collections.list(cl.getResources(name)));
   }
   urls.addAll(Collections.list(super.getResources(name)));
   urls.addAll(Collections.list(getSystemClassLoader().getResources(name)));
   return Collections.enumeration(urls);
 }
Example #2
0
  @Override
  public Class<?> loadClass(String name) throws ClassNotFoundException {
    name = name.trim();
    try {
      return Thread.currentThread().getContextClassLoader().loadClass(name);
    } catch (ClassNotFoundException e) {

    }
    try {
      Class cl = super.loadClass(name);
      LOG.info("---loaded " + name + " from " + this.name);
      return cl;
    } catch (ClassNotFoundException e) {
      LOG.info("---Class " + name + " not found in " + this.name);
    }
    for (ClassLoader cl : parents) {
      try {
        return cl.loadClass(name);
      } catch (ClassNotFoundException e) {
        //
      }
    }
    return getSystemClassLoader().loadClass(name);
  }