From ea48ec9800a08de4d25b03af6b5cea1c252e0b61 Mon Sep 17 00:00:00 2001 From: Sculas Date: Tue, 22 Mar 2022 16:49:19 +0100 Subject: [PATCH 1/2] fix plugin writer with compiled java plugins --- .../the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java index 2ecfa99e..294382b7 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java @@ -12,6 +12,7 @@ import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; +import com.google.common.io.Files; import me.konloch.kontainer.io.DiskReader; import me.konloch.kontainer.io.DiskWriter; import org.apache.commons.compress.utils.FileNameUtils; @@ -188,7 +189,7 @@ public class PluginWriter extends JFrame try { //write to temporary file location - DiskWriter.replaceFile(tempFile.getAbsolutePath(), area.getText(), false); + Files.copy(savePath, tempFile); //run plugin from that location PluginManager.runPlugin(tempFile); } From 6e7db39e66e6e04337ffd26e53947d6b5adb1850 Mon Sep 17 00:00:00 2001 From: Sculas Date: Tue, 22 Mar 2022 17:03:56 +0100 Subject: [PATCH 2/2] use null-safe equals --- .../plugin/strategies/CompiledJavaPluginLaunchStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java index 110f76b5..b8191044 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java @@ -51,7 +51,7 @@ public class CompiledJavaPluginLaunchStrategy implements PluginLaunchStrategy { LoadedNodeData pdata = null; for (LoadedNodeData d : set) { ClassNode cn = d.node; - if (cn.superName.equals(PLUGIN_CLASS_NAME)) { + if (Objects.equals(cn.superName, PLUGIN_CLASS_NAME)) { if (pdata == null) { pdata = d; } else {