summaryrefslogtreecommitdiff
path: root/gnu/java/rmi/server/UnicastServerRef.java
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/java/rmi/server/UnicastServerRef.java')
-rw-r--r--gnu/java/rmi/server/UnicastServerRef.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/gnu/java/rmi/server/UnicastServerRef.java b/gnu/java/rmi/server/UnicastServerRef.java
index 3e9529c59..1c5823a70 100644
--- a/gnu/java/rmi/server/UnicastServerRef.java
+++ b/gnu/java/rmi/server/UnicastServerRef.java
@@ -284,7 +284,16 @@ public Object incomingMessageCall(UnicastConnection conn, int method, long hash)
try{
ret = meth.invoke(myself, args);
}catch(InvocationTargetException e){
- throw (Exception)(e.getTargetException());
+ Throwable cause = e.getTargetException();
+ if (cause instanceof Exception) {
+ throw (Exception)cause;
+ }
+ else if (cause instanceof Error) {
+ throw (Error)cause;
+ }
+ else {
+ throw new Error("The remote method threw a java.lang.Throwable that is neither java.lang.Exception nor java.lang.Error.", e);
+ }
}
return ret;
}