From 20a1a62469ea72f49018c585159f0bfdfc48f4a6 Mon Sep 17 00:00:00 2001 From: Pedro <3602279+Doc94@users.noreply.github.com> Date: Mon, 18 Jul 2022 05:31:33 -0400 Subject: [PATCH] Log IOException in plugin update (#7960) --- patches/api/Update-Folder-Uses-Plugin-Name.patch | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/patches/api/Update-Folder-Uses-Plugin-Name.patch b/patches/api/Update-Folder-Uses-Plugin-Name.patch index 03e43e2fd9..a633c4c6a0 100644 --- a/patches/api/Update-Folder-Uses-Plugin-Name.patch +++ b/patches/api/Update-Folder-Uses-Plugin-Name.patch @@ -48,16 +48,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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; + }