From: Ilya Perminov Date: Fri, 24 Sep 2004 12:29:48 +0000 (+0000) Subject: 2004-09-24 Ilya Perminov X-Git-Tag: releases/gcc-4.0.0~4644 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7c671b94266f4e043466391548054fb144a19db;p=thirdparty%2Fgcc.git 2004-09-24 Ilya Perminov * gnu/java/rmi/server/UnicastServer.java (incomingMessageCall): Added code to handle Errors. * gnu/java/rmi/server/UnicastServerRef.java (incomingMessageCall): Added code to handle Errors. From-SVN: r88030 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 107a673c3e34..ab395dc22af4 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,11 @@ +2004-09-24 Ilya Perminov + + * gnu/java/rmi/server/UnicastServer.java + (incomingMessageCall): Added code to handle Errors. + * gnu/java/rmi/server/UnicastServerRef.java + (incomingMessageCall): Added code to handle Errors. + + 2004-09-24 Tom Tromey * java/lang/ClassLoader.java (loadedClasses): Declare as HashMap. diff --git a/libjava/gnu/java/rmi/server/UnicastServer.java b/libjava/gnu/java/rmi/server/UnicastServer.java index ace43f018616..423095404420 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 3e9529c598b3..1c5823a7070f 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; }