mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-10 09:02:09 -07:00
Close plugin jar file on classloader close and after retrieving name for updating (#8902)
This commit is contained in:
@@ -1993,7 +1993,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
final PluginClassLoader loader;
|
||||
try {
|
||||
- loader = new PluginClassLoader(this, getClass().getClassLoader(), description, dataFolder, file, (libraryLoader != null) ? libraryLoader.createLoader(description) : null);
|
||||
+ loader = new PluginClassLoader(getClass().getClassLoader(), description, dataFolder, file, (libraryLoader != null) ? libraryLoader.createLoader(description) : null); // Paper
|
||||
+ loader = new PluginClassLoader(getClass().getClassLoader(), description, dataFolder, file, (libraryLoader != null) ? libraryLoader.createLoader(description) : null, null); // Paper
|
||||
} catch (InvalidPluginException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
@@ -2040,7 +2040,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
- PluginClassLoader(@NotNull final JavaPluginLoader loader, @Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader) throws IOException, InvalidPluginException, MalformedURLException {
|
||||
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper
|
||||
+ public PluginClassLoader(@Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader) throws IOException, InvalidPluginException, MalformedURLException { // Paper
|
||||
+ public PluginClassLoader(@Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader, @Nullable JarFile jarFile) throws IOException, InvalidPluginException, MalformedURLException { // Paper // Paper - use JarFile provided by SpigotPluginProvider
|
||||
super(new URL[] {file.toURI().toURL()}, parent);
|
||||
- Preconditions.checkArgument(loader != null, "Loader cannot be null");
|
||||
+ this.loader = null; // Paper - pass null into loader field
|
||||
@@ -2049,7 +2049,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.description = description;
|
||||
this.dataFolder = dataFolder;
|
||||
this.file = file;
|
||||
@@ -0,0 +0,0 @@ final class PluginClassLoader extends URLClassLoader {
|
||||
- this.jar = new JarFile(file);
|
||||
+ this.jar = jarFile == null ? new JarFile(file) : jarFile; // Paper - use JarFile provided by SpigotPluginProvider
|
||||
this.manifest = jar.getManifest();
|
||||
this.url = file.toURI().toURL();
|
||||
this.libraryLoader = libraryLoader;
|
||||
|
||||
|
Reference in New Issue
Block a user