diff --git a/remoting/src/main/java/hudson/remoting/UserRequest.java b/remoting/src/main/java/hudson/remoting/UserRequest.java index 66d58201b66b40b6ef7a1e49b1d30520f400f0d5..617e7c1bb81b71e9693467ea3933b91d04b2809a 100644 --- a/remoting/src/main/java/hudson/remoting/UserRequest.java +++ b/remoting/src/main/java/hudson/remoting/UserRequest.java @@ -104,11 +104,17 @@ final class UserResponse implements Serializable { } public RSP retrieve(Channel channel, ClassLoader cl) throws IOException, ClassNotFoundException, EXC { - Object o = new ObjectInputStreamEx(new ByteArrayInputStream(response), cl).readObject(); - if(isException) - throw (EXC)o; - else - return (RSP) o; + Channel old = Channel.setCurrent(channel); + try { + Object o = new ObjectInputStreamEx(new ByteArrayInputStream(response), cl).readObject(); + + if(isException) + throw (EXC)o; + else + return (RSP) o; + } finally { + Channel.setCurrent(old); + } } private static final long serialVersionUID = 1L;