From ff7bd343fc0ba43425e2f0e9ab3ad3432cd6d520 Mon Sep 17 00:00:00 2001 From: TheBiblMan Date: Mon, 1 Jun 2015 15:25:50 +0100 Subject: [PATCH 1/2] Derped when I copied the jar loading code. -Bibl --- .../plugin/strategies/CompiledJavaPluginLaunchStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java index 98e769a4..1225a017 100644 --- a/src/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java @@ -63,7 +63,7 @@ public class CompiledJavaPluginLaunchStrategy implements PluginLaunchStrategy { while ((entry = jis.getNextEntry()) != null) { try { String name = entry.getName(); - if(!name.endsWith(".class")){ + if(name.endsWith(".class")){ byte[] bytes = JarUtils.getBytes(jis); String magic = String.format("%02X", bytes[0]) + String.format("%02X", bytes[1]) + String.format("%02X", bytes[2]) + String.format("%02X", bytes[3]); if(magic.toLowerCase().equals("cafebabe")) { From 6db4dc250054365d67e77ef3662bed14a09922be Mon Sep 17 00:00:00 2001 From: TheBiblMan Date: Mon, 1 Jun 2015 15:29:56 +0100 Subject: [PATCH 2/2] Fixed class loading for compiled Java plugins. -Bibl --- .../strategies/CompiledJavaPluginLaunchStrategy.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java index 1225a017..7ef9e8db 100644 --- a/src/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java @@ -136,9 +136,7 @@ public class CompiledJavaPluginLaunchStrategy implements PluginLaunchStrategy { ccache = new HashMap>(); for(LoadedNodeData d: set) { - if(d != data) { - cache.put(d.node.name, d); - } + cache.put(d.node.name, d); } @SuppressWarnings("unchecked") @@ -152,7 +150,9 @@ public class CompiledJavaPluginLaunchStrategy implements PluginLaunchStrategy { @Override public Class findClass(String name) throws ClassNotFoundException { - name = name.replace("/", "."); + name = name.replace(".", "/"); + + System.out.println("finding " + name); if(ccache.containsKey(name)) return ccache.get(name); @@ -160,7 +160,7 @@ public class CompiledJavaPluginLaunchStrategy implements PluginLaunchStrategy { LoadedNodeData data = cache.get(name); if(data != null) { byte[] bytes = data.bytes; - Class klass = defineClass(data.node.name, bytes, 0, bytes.length); + Class klass = defineClass(data.node.name.replace("/", "."), bytes, 0, bytes.length); ccache.put(name, klass); return klass; }