diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-24 12:29:48 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-24 12:29:48 +0000 |
commit | c88451ca93059985590d9081acad1f0c765c8ac3 (patch) | |
tree | 1414f9fef849b90b5293dd244ccb050373a73eba /libjava/gnu | |
parent | f879717992dec33b8cce22e84c2b03c315bbe828 (diff) | |
download | gcc-c88451ca93059985590d9081acad1f0c765c8ac3.tar.gz |
2004-09-24 Ilya Perminov <iperminov@logicalsoft.com>
* gnu/java/rmi/server/UnicastServer.java
(incomingMessageCall): Added code to handle Errors.
* gnu/java/rmi/server/UnicastServerRef.java
(incomingMessageCall): Added code to handle Errors.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88030 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu')
-rw-r--r-- | libjava/gnu/java/rmi/server/UnicastServer.java | 5 | ||||
-rw-r--r-- | libjava/gnu/java/rmi/server/UnicastServerRef.java | 11 |
2 files changed, 15 insertions, 1 deletions
diff --git a/libjava/gnu/java/rmi/server/UnicastServer.java b/libjava/gnu/java/rmi/server/UnicastServer.java index ace43f01861..42309540442 100644 --- a/libjava/gnu/java/rmi/server/UnicastServer.java +++ b/libjava/gnu/java/rmi/server/UnicastServer.java @@ -46,6 +46,7 @@ import java.net.InetAddress; import java.util.Hashtable; import java.net.UnknownHostException; import java.rmi.Remote; +import java.rmi.ServerError; import java.rmi.server.ObjID; import java.rmi.server.UnicastRemoteObject; import java.rmi.server.UID; @@ -136,6 +137,10 @@ private static void incomingMessageCall(UnicastConnection conn) throws IOExcepti returnval = e; returncode = RETURN_NACK; } + catch (Error e) { + returnval = new ServerError ("An Error is thrown while processing the invocation on the server", e); + returncode = RETURN_NACK; + } } else { returnval = new NoSuchObjectException(""); diff --git a/libjava/gnu/java/rmi/server/UnicastServerRef.java b/libjava/gnu/java/rmi/server/UnicastServerRef.java index 3e9529c598b..1c5823a7070 100644 --- a/libjava/gnu/java/rmi/server/UnicastServerRef.java +++ b/libjava/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; } |