(String name)
| 67 | } |
| 68 | |
| 69 | @Override |
| 70 | protected Class<?> findClass(String name) throws ClassNotFoundException { |
| 71 | try { |
| 72 | return super.findClass(name); |
| 73 | } catch (ClassFormatError e) { |
| 74 | String path = name.replace('.', '/').concat(".class"); |
| 75 | URL url = findResource(path); |
| 76 | if (url == null) { |
| 77 | throw new ClassNotFoundException(name, e); |
| 78 | } |
| 79 | try (InputStream in = url.openStream()) { |
| 80 | ByteArrayOutputStream bos = new ByteArrayOutputStream(); |
| 81 | XKit.transfer(in, bos); |
| 82 | byte[] bytes = bos.toByteArray(); |
| 83 | Object resource = getResource.invoke(urlClassPath, path); |
| 84 | URL codeSourceURL = (URL) getCodeSourceURL.invoke(resource); |
| 85 | CodeSigner[] codeSigners = (CodeSigner[]) getCodeSigners.invoke(resource); |
| 86 | CodeSource codeSource = new CodeSource(codeSourceURL, codeSigners); |
| 87 | return defineClass(name, bytes, 0, bytes.length, codeSource); |
| 88 | } catch (Throwable t) { |
| 89 | throw new ClassNotFoundException(name, t); |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | private class XBootEnumeration implements Enumeration<URL> { |
| 95 | private final Enumeration<URL> enumeration; |
nothing calls this directly
no test coverage detected