Skip to content

Commit

Permalink
restore compatability for older versions
Browse files Browse the repository at this point in the history
3244.vf7f977e04755 requires the agent to be upgraded in lockstep with
Jenkins to avoid remoting errors such as:

java.lang.IllegalStateException: Unable to call getName. No matching method found in [interface hudson.remoting.RemoteClassLoader$IClassLoader] for hudson.remoting.RemoteClassLoader$ClassLoaderProxy@2cdf8d8a[jdk.internal.loader.ClassLoaders$AppClassLoader@2cdf8d8a]

This restores the compatability by specifically handling a method call
to getName for the IClassLoader and returning a dummy value if the
remote version is older than 3244
  • Loading branch information
jtnord committed May 15, 2024
1 parent 90d12e3 commit 5472f9a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/hudson/remoting/RemoteClassLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ public static ClassLoader create(@CheckForNull ClassLoader parent, @NonNull ICla
name = proxy.getName();
} catch(IOException ignored) {
name = String.format(Locale.ROOT, "unknown-due-to-io-error %1$#x", System.identityHashCode(proxy));
} catch (IllegalStateException ignored) {
// IllegalStateException is thrown if the method does not exist on the remote side.
// TODO remove this at some point in the future when Jenkins sets the minimum remoting version to

Check warning on line 182 in src/main/java/hudson/remoting/RemoteClassLoader.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: remove this at some point in the future when Jenkins sets the minimum remoting version to
// 3244.vf7f977e04755 or higher
name = String.format(Locale.ROOT, "upgrade-remoting-to-3244.vf7f977e04755-or-higher %1$#x", System.identityHashCode(proxy));
}
return new RemoteClassLoader(name, parent, proxy);
}
Expand Down

0 comments on commit 5472f9a

Please sign in to comment.