diff options
author | md_5 <git@md-5.net> | 2018-01-03 15:43:47 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-01-03 15:43:47 +1100 |
commit | 8707a3a572bcd4168e2548d06b050b10d5dc5582 (patch) | |
tree | 074d1fca199c2896740752b0cac8759ebcdd9ccc /src | |
parent | 07afa3d58b1869147b5e6b44e1227001512a68d1 (diff) | |
download | bukkit-8707a3a572bcd4168e2548d06b050b10d5dc5582.tar bukkit-8707a3a572bcd4168e2548d06b050b10d5dc5582.tar.gz bukkit-8707a3a572bcd4168e2548d06b050b10d5dc5582.tar.lz bukkit-8707a3a572bcd4168e2548d06b050b10d5dc5582.tar.xz bukkit-8707a3a572bcd4168e2548d06b050b10d5dc5582.zip |
Be more resilient to asynchronous package loads like URLClassLoader
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/plugin/java/PluginClassLoader.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java index 9fc6bd77..7e41e79a 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java @@ -104,10 +104,16 @@ final class PluginClassLoader extends URLClassLoader { if (dot != -1) { String pkgName = name.substring(0, dot); if (getPackage(pkgName) == null) { - if (manifest != null) { - definePackage(pkgName, manifest, url); - } else { - definePackage(pkgName, null, null, null, null, null, null, null); + try { + if (manifest != null) { + definePackage(pkgName, manifest, url); + } else { + definePackage(pkgName, null, null, null, null, null, null, null); + } + } catch (IllegalArgumentException ex) { + if (getPackage(pkgName) == null) { + throw new IllegalStateException("Cannot find package " + pkgName); + } } } } |