Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FIXED JENKINS-9050] Improved the error diagnostics when a remote met…
…hod call fails to deserialize.
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,37 @@ | ||
package hudson.remoting; | ||
|
||
import org.jvnet.hudson.test.Bug; | ||
|
||
import java.io.IOException; | ||
import java.io.ObjectInputStream; | ||
|
||
/** | ||
* @author Kohsuke Kawaguchi | ||
*/ | ||
public class ChannelTest extends RmiTestBase { | ||
public void testCapability() { | ||
assertTrue(channel.remoteCapability.supportsMultiClassLoaderRPC()); | ||
} | ||
|
||
@Bug(9050) | ||
public void testFailureInDeserialization() throws Exception { | ||
try { | ||
channel.call(new CallableImpl()); | ||
fail(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
assertEquals("foobar",e.getCause().getCause().getMessage()); | ||
assertTrue(e.getCause().getCause() instanceof ClassCastException); | ||
} | ||
} | ||
|
||
private static class CallableImpl implements Callable<Object,IOException> { | ||
public Object call() throws IOException { | ||
return null; | ||
} | ||
|
||
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { | ||
throw new ClassCastException("foobar"); | ||
} | ||
} | ||
} |