gnodet commented on code in PR #1945:
URL: https://github.com/apache/maven-resolver/pull/1945#discussion_r3537256011


##########
maven-resolver-named-locks-ipc/src/main/java/org/eclipse/aether/named/ipc/IpcClient.java:
##########
@@ -262,7 +263,15 @@ SocketChannel createClient() throws IOException {
     private String getJarPath(Class<?> clazz) {
         String classpath;
         String className = clazz.getName().replace('.', '/') + ".class";
-        String url = clazz.getClassLoader().getResource(className).toString();
+        ClassLoader classLoader = clazz.getClassLoader();
+        if (classLoader == null) {
+            classLoader = ClassLoader.getSystemClassLoader();
+        }
+        URL resource = classLoader.getResource(className);
+        if (resource == null) {
+            throw new IllegalStateException("Unable to find resource for class 
" + clazz.getName());
+        }

Review Comment:
   Good catch. Switched to `clazz.getResource("/" + className)` which handles 
bootstrap-loaded classes natively — `Class.getResource()` internally delegates 
to `ClassLoader.getSystemResource()` when the classloader is null, so no 
explicit fallback is needed. Fixed in c2464e0c.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to