Commits
md_5 authored 20971610daa
37 37 | private IllegalStateException pluginState; |
38 38 | |
39 39 | PluginClassLoader(final JavaPluginLoader loader, final ClassLoader parent, final PluginDescriptionFile description, final File dataFolder, final File file) throws IOException, InvalidPluginException, MalformedURLException { |
40 40 | super(new URL[] {file.toURI().toURL()}, parent); |
41 41 | Validate.notNull(loader, "Loader cannot be null"); |
42 42 | |
43 43 | this.loader = loader; |
44 44 | this.description = description; |
45 45 | this.dataFolder = dataFolder; |
46 46 | this.file = file; |
47 - | this.jar = new JarFile(file, true); |
47 + | this.jar = new JarFile(file); |
48 48 | this.manifest = jar.getManifest(); |
49 49 | this.url = file.toURI().toURL(); |
50 50 | |
51 51 | try { |
52 52 | Class<?> jarClass; |
53 53 | try { |
54 54 | jarClass = Class.forName(description.getMain(), true, this); |
55 55 | } catch (ClassNotFoundException ex) { |
56 56 | throw new InvalidPluginException("Cannot find main class `" + description.getMain() + "'", ex); |
57 57 | } |
97 97 | try (InputStream is = jar.getInputStream(entry)) { |
98 98 | classBytes = ByteStreams.toByteArray(is); |
99 99 | } catch (IOException ex) { |
100 100 | throw new ClassNotFoundException(name, ex); |
101 101 | } |
102 102 | |
103 103 | int dot = name.lastIndexOf('.'); |
104 104 | if (dot != -1) { |
105 105 | String pkgName = name.substring(0, dot); |
106 106 | if (getPackage(pkgName) == null) { |
107 - | definePackage(pkgName, manifest, url); |
107 + | if (manifest != null) { |
108 + | definePackage(pkgName, manifest, url); |
109 + | } else { |
110 + | definePackage(pkgName, null, null, null, null, null, null, null); |
111 + | } |
108 112 | } |
109 113 | } |
110 114 | |
111 115 | CodeSigner[] signers = entry.getCodeSigners(); |
112 116 | CodeSource source = new CodeSource(url, signers); |
113 117 | |
114 118 | result = defineClass(name, classBytes, 0, classBytes.length, source); |
115 119 | } |
116 120 | |
117 121 | if (result == null) { |