private Class<?> getLoadedClass(String className, boolean resolve) throws ClassNotFoundException { synchronized (getClassLoadingLock(className)) { Class<?> loadedClass = findLoadedClass(className); if (classes.containsKey(className)) { return classes.get(className); } if (byteCache.containsKey(className)) { definePackageForClass(className); byte[] classBytes = byteCache.get(className); if (loadedClass == null) { //We got here without Exception, meaning class was filtered from proxying. Load normally: try { loadedClass = defineClass(className, classBytes, 0, classBytes.length, this.getClass().getProtectionDomain()); } catch (NoClassDefFoundError | IncompatibleClassChangeError e) { throw new ClassNotFoundException(className, e); } } classes.put(className, loadedClass); if (resolve) { resolveClass(loadedClass); } return loadedClass; } else { return null; } } }
private Class<?> getLoadedClass(String className, boolean resolve) throws ClassNotFoundException { synchronized (getClassLoadingLock(className)) { Class<?> loadedClass = findLoadedClass(className); if (classes.containsKey(className)) { return classes.get(className); } if (byteCache.containsKey(className)) { definePackageForClass(className); byte[] classBytes = byteCache.get(className); if (loadedClass == null) { //We got here without Exception, meaning class was filtered from proxying. Load normally: try { loadedClass = defineClass(className, classBytes, 0, classBytes.length, this.getClass().getProtectionDomain()); } catch (NoClassDefFoundError | IncompatibleClassChangeError e) { throw new ClassNotFoundException(className, e); } } classes.put(className, loadedClass); if (resolve) { resolveClass(loadedClass); } return loadedClass; } else { return null; } } }
@Override public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { synchronized (getClassLoadingLock(name)) { Class<?> found = findLoadedClass(name); if (found != null) { return found; } if (name.startsWith("io.squark.nestedjarclassloader")) { return ((NestedJarClassLoader) getParent()).loadClass(name, resolve); } found = findLocalClass(name, resolve); if (found == null) { //Will cause redundancy, but unavoidable for now. found = ((NestedJarClassLoader) getParent()).loadClass(name, resolve); } return found; } }
@Override public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { synchronized (getClassLoadingLock(name)) { Class<?> found = findLoadedClass(name); if (found != null) { return found; } if (name.startsWith("io.squark.nestedjarclassloader")) { return ((NestedJarClassLoader) getParent()).loadClass(name, resolve); } found = findLocalClass(name, resolve); if (found == null) { //Will cause redundancy, but unavoidable for now. found = ((NestedJarClassLoader) getParent()).loadClass(name, resolve); } return found; } }