Skip to content

Commit 2bc68fb

Browse files
committed
Merge pull request Konloch#47 from TheBiblMan/master
Compiled Java Plugin Loading
2 parents 24edd7c + 6db4dc2 commit 2bc68fb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private static Set<LoadedNodeData> loadData(File jarFile) throws Throwable {
6363
while ((entry = jis.getNextEntry()) != null) {
6464
try {
6565
String name = entry.getName();
66-
if(!name.endsWith(".class")){
66+
if(name.endsWith(".class")){
6767
byte[] bytes = JarUtils.getBytes(jis);
6868
String magic = String.format("%02X", bytes[0]) + String.format("%02X", bytes[1]) + String.format("%02X", bytes[2]) + String.format("%02X", bytes[3]);
6969
if(magic.toLowerCase().equals("cafebabe")) {
@@ -136,9 +136,7 @@ public LoadingClassLoader(LoadedNodeData data, Set<LoadedNodeData> set) throws T
136136
ccache = new HashMap<String, Class<?>>();
137137

138138
for(LoadedNodeData d: set) {
139-
if(d != data) {
140-
cache.put(d.node.name, d);
141-
}
139+
cache.put(d.node.name, d);
142140
}
143141

144142
@SuppressWarnings("unchecked")
@@ -152,15 +150,17 @@ public LoadingClassLoader(LoadedNodeData data, Set<LoadedNodeData> set) throws T
152150

153151
@Override
154152
public Class<?> findClass(String name) throws ClassNotFoundException {
155-
name = name.replace("/", ".");
153+
name = name.replace(".", "/");
154+
155+
System.out.println("finding " + name);
156156

157157
if(ccache.containsKey(name))
158158
return ccache.get(name);
159159

160160
LoadedNodeData data = cache.get(name);
161161
if(data != null) {
162162
byte[] bytes = data.bytes;
163-
Class<?> klass = defineClass(data.node.name, bytes, 0, bytes.length);
163+
Class<?> klass = defineClass(data.node.name.replace("/", "."), bytes, 0, bytes.length);
164164
ccache.put(name, klass);
165165
return klass;
166166
}

0 commit comments

Comments
 (0)