/** * Returns true if the specified path of URLs is equal to the * annotation URLs of the specified loader, and false otherwise. **/ private boolean urlsMatchLoaderAnnotation(Uri[] urls, ClassLoader loader) { try { return Arrays.equals(urls, getLoaderAnnotationURIs(loader)); } catch (MalformedURLException e) { return false; } }
private ClassLoader findOriginLoader0(Uri[] pathURLs, ClassLoader parent) { for (ClassLoader ancestor = parent; ancestor != null; ancestor = ancestor.getParent()) { Uri[] ancestorURLs; try { ancestorURLs = getLoaderAnnotationURIs(ancestor); } catch (MalformedURLException e) { // this ancestor's annotation must not match pathURLs continue; } /* check if found a matching ancestor loader */ if (Arrays.equals(pathURLs, ancestorURLs)) { if (logger.isLoggable(Level.FINEST)) { logger.log(Level.FINEST, "using an existing ancestor class loader " + "which serves the requested codebase urls: {0}, " + "urls: {1}", new Object[] { ancestor, (ancestorURLs != null ? Arrays.asList(ancestorURLs) : null) }); } return ancestor; } } return null; }