@Test public void testFindResource() { if (isJDK9()) return; URL resource = pwcl.getResource("javax/xml/ws/Service.class"); URL object = pwcl.getResource("java/lang/Object.class"); String resJar = resource.getPath().substring(0, resource.getPath().indexOf("!")); String rtJar = object.getPath().substring(0, object.getPath().indexOf("!")); Assert.assertEquals(resJar, rtJar); }
@Override protected URL findResource(String name) { URL u = getParent().getResource(prefix + name); if (u != null) { try { jars.add(new JarFile(new File(toJarUrl(u).toURI()))); } catch (URISyntaxException | IOException ex) { Logger.getLogger(ParallelWorldClassLoader.class.getName()).log(Level.WARNING, null, ex); } catch (ClassNotFoundException ex) { } } return u; }
ParallelWorldClassLoader extends ClassLoader implements Closeable { @Override protected URL findResource(String name) { URL u = getParent().getResource(prefix + name); if (u != null) { try { jars.add(new JarFile(new File(toJarUrl(u).toURI()))); } catch (URISyntaxException | IOException ex) { Logger.getLogger(ParallelWorldClassLoader.class.getName()).log(Level.WARNING, null, ex); } catch (ClassNotFoundException ex) { } } return u; } }
ParallelWorldClassLoader extends ClassLoader implements Closeable { @Override protected URL findResource(String name) { URL u = getParent().getResource(prefix + name); if (u != null) { try { jars.add(new JarFile(new File(toJarUrl(u).toURI()))); } catch (URISyntaxException | IOException ex) { Logger.getLogger(ParallelWorldClassLoader.class.getName()).log(Level.WARNING, null, ex); } catch (ClassNotFoundException ex) { } } return u; } ParallelWorldClassLoader(ClassLoader parent,String prefix); }
ParallelWorldClassLoader extends ClassLoader implements Closeable { @Override protected URL findResource(String name) { URL u = getParent().getResource(prefix + name); if (u != null) { try { jars.add(new JarFile(new File(toJarUrl(u).toURI()))); } catch (URISyntaxException | IOException ex) { Logger.getLogger(ParallelWorldClassLoader.class.getName()).log(Level.WARNING, null, ex); } catch (ClassNotFoundException ex) { } } return u; } ParallelWorldClassLoader(ClassLoader parent,String prefix); @Override synchronized void close(); static URL toJarUrl(URL res); }
ParallelWorldClassLoader extends ClassLoader implements Closeable { @Override protected URL findResource(String name) { URL u = getParent().getResource(prefix + name); if (u != null) { try { jars.add(new JarFile(new File(toJarUrl(u).toURI()))); } catch (URISyntaxException | IOException ex) { Logger.getLogger(ParallelWorldClassLoader.class.getName()).log(Level.WARNING, null, ex); } catch (ClassNotFoundException ex) { } } return u; } ParallelWorldClassLoader(ClassLoader parent,String prefix); @Override synchronized void close(); static URL toJarUrl(URL res);  }