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 e718884
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/hudson/remoting/RemoteInvocationHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -916,8 +916,16 @@ protected Serializable perform(@NonNull Channel channel) throws Throwable {
Class<?>[] clazz = channel.getExportedTypes(oid);
try {
Method m = choose(clazz);
if(m==null)
if(m==null) {
// TODO this workaround can be deleted when Jenkins minimum remoting version > 3244.vf7f977e04755

Check warning on line 920 in src/main/java/hudson/remoting/RemoteInvocationHandler.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: this workaround can be deleted when Jenkins minimum remoting version > 3244.vf7f977e04755
// https://github.com/jenkinsci/jenkins/blob/bcb5ed8f2218208b11b029d023a70bc7c0851418/pom.xml#L92C5-L92C40
if ("hudson.remoting.RemoteClassLoader$IClassLoader".equals(declaringClassName) && "getName".equals(methodName)) {
// the other side does not have #741
// there's no name and the return is a String. Return something
return "upgrade-remoting-to-3244.vf7f977e04755-or-higher";
}
throw new IllegalStateException("Unable to call " + methodName + ". No matching method found in " + Arrays.toString(clazz) + " for " + o);
}
m.setAccessible(true); // in case the class is not public
Object r;
try {
Expand Down

0 comments on commit e718884

Please sign in to comment.