@SuppressWarnings("unchecked") @Override public Enumeration<URL> findResources(final String name) throws IOException { Enumeration<URL> e = bundle.getResources(name); // For some reason, getResources() sometimes returns nothing, yet getResource() will return one. This code // handles that strange case if (e != null && !e.hasMoreElements()) { final URL resource = findResource(name); if (resource != null) { e = new IteratorEnumeration(Arrays.asList(resource).iterator()); } } return e; }
public static ClassLoader getClassLoader(final Bundle bundle) { return new BundleClassLoader(bundle, new AlternativeDirectoryResourceLoader()); }