From aa6bf6c1a82c876379e4cb4473da84138c403ac8 Mon Sep 17 00:00:00 2001 From: "David M. Lloyd" Date: Fri, 4 Oct 2024 19:25:58 -0500 Subject: [PATCH] Fix faulty class loader --- .../quarkus/launcher/RuntimeLaunchClassLoader.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/core/launcher/src/main/java/io/quarkus/launcher/RuntimeLaunchClassLoader.java b/core/launcher/src/main/java/io/quarkus/launcher/RuntimeLaunchClassLoader.java index 691afcc0f3c7b..95a30f95f76c8 100644 --- a/core/launcher/src/main/java/io/quarkus/launcher/RuntimeLaunchClassLoader.java +++ b/core/launcher/src/main/java/io/quarkus/launcher/RuntimeLaunchClassLoader.java @@ -1,6 +1,5 @@ package io.quarkus.launcher; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; @@ -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); }