Returns a classloader at specified depth of the current execution stack.

@return the classloader at the specified depth of the current execution
stack. Migth return null if depth is out of range.
775412
public static ClassLoader getClassLoaderContextAt(int i) {
		Class[] classes = MANAGER.getClassContext();
		if (classes != null && classes.length > i) {
			return classes[i].getClassLoader();
		}
		return null;
	}
224382
public static final CClassLoader getLoader(final String fpath) {
		String path = fpath;
		CClassLoader currentLoader = CClassLoader.rootLoader;

		if (path == null) {
			return CClassLoader.getRootLoader();
		}

		if (path.startsWith(CClassLoader.ROOT_LOADER)) {
			path = path.substring(10);
		}

		final StringTokenizer tokenizer = new StringTokenizer(path, "/", false);

		while (tokenizer.hasMoreTokens()) {
			final String name = tokenizer.nextToken();
			currentLoader = currentLoader.getLoaderByName(name);
		}

		return currentLoader;
	}
1044245
@Override
  public ClassLoader getClassLoader() {
    URL[] urlsForClassLoader = new URL[urls.size()];
    urls.toArray(urlsForClassLoader);

    URLClassLoader classLoader = new URLClassLoader(urlsForClassLoader);
    Thread.currentThread().setContextClassLoader(classLoader);

    return classLoader;
  }
99256
public synchronized static ApplicationClassLoader getNodeApplicationClassLoader() {
        if (nodeApplicationClassLoader != null) {
            return nodeApplicationClassLoader;
        }
        if (systemClassLoader == null) {
            throw new IllegalStateException("Can't create nodeClassLoader because systemClassLoader is null.");
        }
        nodeApplicationClassLoader = new ApplicationClassLoader(systemClassLoader, true);
        return nodeApplicationClassLoader;
    }
1011380
@Override
    public ClassLoader getClassLoader(String identifier) throws IllegalArgumentException {
        if (identifier == null)
            return null;
        ThreadContextClassLoader classloader = tcclStore.retrieve(identifier);
        if (classloader != null) {
            return classloader;
        }
        return null;
    }
1096986
public static ClassLoader getClassLoader(Class<?> cls) {
        ClassLoader cl = null;
        try {
            cl = Thread.currentThread().getContextClassLoader();
        } catch (Throwable ex) {
            // Cannot access thread context ClassLoader - falling back to system
            // class loader...
        }
        if (cl == null) {
            // No thread context class loader -> use class loader of this class.
            cl = cls.getClassLoader();
        }
        return cl;
    }
589352
private Class<?> loadClass(final ClassLoader lastLoader, final String className) {
        // XXX: this is overly complicated
        Class<?> clazz;
        if (lastLoader != null) {
            try {
                clazz = lastLoader.loadClass(className);
                if (clazz != null) {
                    return clazz;
                }
            } catch (final Throwable ignore) {
                // Ignore exception.
            }
        }
        try {
            clazz = LoaderUtil.loadClass(className);
        } catch (final ClassNotFoundException | NoClassDefFoundError e) {
            return loadClass(className);
        } catch (final SecurityException e) {
            return null;
        }
        return clazz;
    }
754393
@NonNull
    @Override
    public Loader<SortedList<File>> getLoader() {
        return new AsyncTaskLoader<SortedList<File>>(getActivity()) {

            FileObserver fileObserver;

            @Override
            public SortedList<File> loadInBackground() {
                File[] listFiles = mCurrentPath.listFiles();
                final int initCap = listFiles == null ? 0 : listFiles.length;

                SortedList<File> files = new SortedList<>(File.class, new SortedListAdapterCallback<File>(getDummyAdapter()) {
                    @Override
                    public int compare(File lhs, File rhs) {
                        return compareFiles(lhs, rhs);
                    }

                    @Override
                    public boolean areContentsTheSame(File file, File file2) {
                        return file.getAbsolutePath().equals(file2.getAbsolutePath()) && (file.isFile() == file2.isFile());
                    }

                    @Override
                    public boolean areItemsTheSame(File file, File file2) {
                        return areContentsTheSame(file, file2);
                    }
                }, initCap);


                files.beginBatchedUpdates();
                if (listFiles != null) {
                    for (java.io.File f : listFiles) {
                        if (isItemVisible(f)) {
                            files.add(f);
                        }
                    }
                }
                files.endBatchedUpdates();

                return files;
            }

            /**
             * Handles a request to start the Loader.
             */
            @Override
            protected void onStartLoading() {
                super.onStartLoading();

                // handle if directory does not exist. Fall back to root.
                if (mCurrentPath == null || !mCurrentPath.isDirectory()) {
                    mCurrentPath = getRoot();
                }

                // Start watching for changes
                fileObserver = new FileObserver(mCurrentPath.getPath(),
                        FileObserver.CREATE |
                                FileObserver.DELETE
                                | FileObserver.MOVED_FROM | FileObserver.MOVED_TO
                ) {

                    @Override
                    public void onEvent(int event, String path) {
                        // Reload
                        onContentChanged();
                    }
                };
                fileObserver.startWatching();

                forceLoad();
            }

            /**
             * Handles a request to completely reset the Loader.
             */
            @Override
            protected void onReset() {
                super.onReset();

                // Stop watching
                if (fileObserver != null) {
                    fileObserver.stopWatching();
                    fileObserver = null;
                }
            }
        };
    }
868296
@SuppressWarnings( { "unchecked" })
    public Class<Object> getCaller() {
        Class<Object> aClass = null;

        // Walk the stack backwards to find the calling class: don't
        // want to use Class.forName, because we want the class as loaded
        // by it's original classloader
        Class<Object> stack[] = (Class<Object>[]) this.getClassContext();
        for (Class<Object> bClass : stack) {
            // Find the first class in the stack that _isn't_ Tr or StackFinder,
            // etc. Use the name rather than the class instance (to also work across
            // classloaders, should that happen)
            String name = bClass.getName();
            if (!name.endsWith("ras.Tr") && // ejs or websphere
                !name.endsWith("ras.TraceNLS") &&
                !name.endsWith("internal.StackFinder") &&
                !name.endsWith("internal.TraceNLSResolver") &&
                !name.endsWith("internal.WsLogger")) {
                aClass = bClass;
                break;
            }
        }

        return aClass;
    }
808410
public static ClassLoader getExtensionClassLoader() {
        final Collection<ClassLoader> childClassLoaders = new ArrayList<>();
        childClassLoaders.addAll(_allExtensionClassLoaders);
        childClassLoaders.add(ClassLoaderUtils.getParentClassLoader());
        return new CompoundClassLoader(childClassLoaders);
    }
404608
public static ClassLoader getClassLoader(final Class<?> c)
   {
      if (System.getSecurityManager() == null)
         return c.getClassLoader();

      return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
      {
         public ClassLoader run()
         {
            return c.getClassLoader();
         }
      });
   }
193872
static Class<?> findClassFromClassLoaders(final String className, final Iterable<ClassLoader> classLoaders)
        throws ClassNotFoundException, IllegalArgumentException {
        // Precondition checks
        assert className != null && className.length() > 0 : "Class Name must be specified";
        assert classLoaders != null : "ClassLoaders as search path must be specified";

        // Find the class by searching through the CLs in order
        Class<?> clazz = null;
        for (final ClassLoader cl : classLoaders) {
            try {
                clazz = Class.forName(className, false, cl);
                if (log.isLoggable(Level.FINER)) {
                    log.finer("Found requested class " + clazz.getName() + " from ClassLoader "
                        + clazz.getClassLoader());
                }
            } catch (final ClassNotFoundException cnfe) {
                // Ignore here, try the next
            }

        }
        // If we haven't got a class yet, now we need to show we've got CNFE
        if (clazz == null) {
            throw new ClassNotFoundException("Could not find requested class \"" + className
                + "\" in any of the associated ClassLoaders: " + classLoaders);
        }

        // Return
        return clazz;
    }
720609
public static ApplicationContext get() {
        ClassLoader classLoader = getContextClassLoader();
        while (classLoader != null) {
            ApplicationContext applicationContext = contextMap.get(classLoader);
            if (applicationContext != null) {
                return applicationContext;
            }
            classLoader = classLoader.getParent();
        }
        return null;
    }
633999
private static ClassLoader getPlatformClassLoader() {
        if (JavaInfo.majorVersion() >= 9) {
            return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
                @Override
                public ClassLoader run() {
                    ClassLoader pcl = null;
                    try {
                        Method getPlatformClassLoader = ClassLoader.class.getMethod("getPlatformClassLoader");
                        pcl = (ClassLoader) getPlatformClassLoader.invoke(null);
                    } catch (Throwable t) {
                        // Log an FFDC.
                    }
                    return pcl;
                }
            });
        }
        return null;
    }
99912
public static DynamicClassLoader getDynamicClassLoader(ClassLoader loader)
  {
    for (; loader != null; loader = loader.getParent()) {
      if (loader instanceof DynamicClassLoader) {
        return (DynamicClassLoader) loader;
      }
    }

    return null;
  }
92648
private static ClassLoader extensionClassLoader(final ClassLoader environment) {
    ClassLoader cl = environment;
    ClassLoader prev = null;
    while (cl != null) {
      prev = cl;
      cl = cl.getParent();
    }
    return prev;
  }
537570
public JClass getSuperClass()
  {
    lazyLoad();
    
    if (_superClass == null)
      return null;
    else
      return getClassLoader().forName(_superClass.replace('/', '.'));
  }