Commit c7c671b9 by Ilya Perminov Committed by Michael Koch

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.

From-SVN: r88030
parent 4a198dea
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.
2004-09-24 Tom Tromey <tromey@redhat.com> 2004-09-24 Tom Tromey <tromey@redhat.com>
* java/lang/ClassLoader.java (loadedClasses): Declare as HashMap. * java/lang/ClassLoader.java (loadedClasses): Declare as HashMap.
......
...@@ -46,6 +46,7 @@ import java.net.InetAddress; ...@@ -46,6 +46,7 @@ import java.net.InetAddress;
import java.util.Hashtable; import java.util.Hashtable;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.rmi.Remote; import java.rmi.Remote;
import java.rmi.ServerError;
import java.rmi.server.ObjID; import java.rmi.server.ObjID;
import java.rmi.server.UnicastRemoteObject; import java.rmi.server.UnicastRemoteObject;
import java.rmi.server.UID; import java.rmi.server.UID;
...@@ -136,6 +137,10 @@ private static void incomingMessageCall(UnicastConnection conn) throws IOExcepti ...@@ -136,6 +137,10 @@ private static void incomingMessageCall(UnicastConnection conn) throws IOExcepti
returnval = e; returnval = e;
returncode = RETURN_NACK; 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 { else {
returnval = new NoSuchObjectException(""); returnval = new NoSuchObjectException("");
......
...@@ -284,7 +284,16 @@ public Object incomingMessageCall(UnicastConnection conn, int method, long hash) ...@@ -284,7 +284,16 @@ public Object incomingMessageCall(UnicastConnection conn, int method, long hash)
try{ try{
ret = meth.invoke(myself, args); ret = meth.invoke(myself, args);
}catch(InvocationTargetException e){ }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; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment