Log IOException in plugin update (#7960)

This commit is contained in:
Pedro 2022-07-18 05:31:33 -04:00 committed by GitHub
parent 036a09c300
commit fdd910e0cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 5 deletions

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Update Folder Uses Plugin Name
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 45114d587a8f201778adcba16c8a019f9959f472..ed07f5820281b139739f673fa4e25171de81b894 100644
index 45114d587a8f201778adcba16c8a019f9959f472..5270e43c629fe63f42691d10c6f77dc1cc987457 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -395,7 +395,7 @@ public final class SimplePluginManager implements PluginManager {
@ -17,7 +17,7 @@ index 45114d587a8f201778adcba16c8a019f9959f472..ed07f5820281b139739f673fa4e25171
Set<Pattern> filters = fileAssociations.keySet();
Plugin result = null;
@@ -422,16 +422,56 @@ public final class SimplePluginManager implements PluginManager {
@@ -422,16 +422,61 @@ public final class SimplePluginManager implements PluginManager {
return result;
}
@ -48,16 +48,21 @@ index 45114d587a8f201778adcba16c8a019f9959f472..ed07f5820281b139739f673fa4e25171
+ continue;
+ }
+ if (!pluginName.equals(updatePluginName)) continue;
+ if (!FileUtil.copy(updateFile, file)) continue;
+ try {
+ java.nio.file.Files.copy(updateFile.toPath(), file.toPath());
+ } catch (java.io.IOException exception) {
+ server.getLogger().log(Level.SEVERE, "Could not copy '" + updateFile.getPath() + "' to '" + file.getPath() + "' in update plugin process", exception);
+ continue;
+ }
+ File newName = new File(file.getParentFile(), updateFile.getName());
+ file.renameTo(newName);
+ updateFile.delete();
+ return newName;
+ }
+ }
}
+ catch (InvalidDescriptionException e) {
+ throw new InvalidPluginException(e);
}
+ }
+ return file;
+ }