Skip to content

Commit

Permalink
Make "unknown" classloader unique
Browse files Browse the repository at this point in the history
If we can not obtain the name of the classloader then add the proxies
identityHashCode so they will be unique amongst all others.
  • Loading branch information
jtnord committed May 15, 2024
1 parent fe5ce63 commit 98cc05c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/hudson/remoting/RemoteClassLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
Expand Down Expand Up @@ -175,7 +176,7 @@ public static ClassLoader create(@CheckForNull ClassLoader parent, @NonNull ICla
try {
name = proxy.getName();
} catch(IOException ignored) {
name = "unknown-due-to-io-error";
name = String.format(Locale.ROOT, "unknown-due-to-io-error %1$#x", System.identityHashCode(proxy));
}
return new RemoteClassLoader(name, parent, proxy);
}
Expand Down

0 comments on commit 98cc05c

Please sign in to comment.