Skip to content

Commit

Permalink
Fix faulty class loader
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlloyd committed Oct 5, 2024
1 parent 2a9f27d commit aa6bf6c
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkus.launcher;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
Expand All @@ -18,20 +17,14 @@ public RuntimeLaunchClassLoader(ClassLoader parent) {

@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
String resourceName = name.replace(".", "/") + ".class";
String resourceName = "META-INF/ide-deps/" + name.replace(".", "/") + ".class.ide-launcher-res";
try {
try (InputStream is = getResourceAsStream(resourceName)) {
try (InputStream is = getParent().getResourceAsStream(resourceName)) {
if (is == null) {
throw new ClassNotFoundException(name);
}
definePackage(name);
byte[] buf = new byte[1024];
int r;
ByteArrayOutputStream out = new ByteArrayOutputStream();
while ((r = is.read(buf)) > 0) {
out.write(buf, 0, r);
}
byte[] bytes = out.toByteArray();
byte[] bytes = is.readAllBytes();

return defineClass(name, bytes, 0, bytes.length);
}
Expand Down

0 comments on commit aa6bf6c

Please sign in to comment.