adc 2004/02/16 09:51:02
Modified: modules/remoting/src/java/org/apache/geronimo/remoting
DeMarshalingInterceptor.java
MarshalingInterceptor.java
Log:
Proper separation of application and server exceptions.
Revision Changes Path
1.5 +5 -17
incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/DeMarshalingInterceptor.java
Index: DeMarshalingInterceptor.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/DeMarshalingInterceptor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DeMarshalingInterceptor.java 15 Feb 2004 18:23:28 -0000 1.4
+++ DeMarshalingInterceptor.java 16 Feb 2004 17:51:02 -0000 1.5
@@ -79,13 +79,6 @@
this.classloader = classloader;
}
- public static class ThrowableWrapper implements Serializable {
- ThrowableWrapper(Throwable exception) {
- this.exception = exception;
- }
- public Throwable exception;
- }
-
/**
* @return
*/
@@ -112,21 +105,16 @@
marshalledInvocation = (Invocation) mo.get();
} catch (Throwable e) {
// Could not deserialize the invocation...
- mo.set(new ThrowableWrapper(e));
+ mo.set(e);
return new SimpleInvocationResult(false, mo);
}
try {
InvocationResult rc = next.invoke(marshalledInvocation);
- if (rc.isNormal()) {
- mo.set(rc.getResult());
- return new SimpleInvocationResult(true, mo);
- } else {
- mo.set(new ThrowableWrapper((Throwable)rc.getResult()));
- return new SimpleInvocationResult(false, mo);
- }
+ mo.set(rc);
+ return new SimpleInvocationResult(true, mo);
} catch (Throwable e) {
- mo.set(new ThrowableWrapper(e));
+ mo.set(e);
return new SimpleInvocationResult(false, mo);
}
1.4 +6 -8
incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/MarshalingInterceptor.java
Index: MarshalingInterceptor.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/MarshalingInterceptor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MarshalingInterceptor.java 26 Nov 2003 20:54:28 -0000 1.3
+++ MarshalingInterceptor.java 16 Feb 2004 17:51:02 -0000 1.4
@@ -86,22 +86,20 @@
// Demarshal the result.
mo = (MarshalledObject) rc.getResult();
- Object result;
+ InvocationResult result;
try {
- result = mo.get();
+ result = (InvocationResult)mo.get();
} catch ( ClassNotFoundException e ) {
// Weird.
Thread.currentThread().setContextClassLoader(MarshalingInterceptor.class.getClassLoader());
- result = mo.get();
+ result = (InvocationResult)mo.get();
}
// Are we demarshalling a thrown exception.
- if (result instanceof DeMarshalingInterceptor.ThrowableWrapper) {
- throw ((DeMarshalingInterceptor.ThrowableWrapper)
result).exception;
- }
- return new SimpleInvocationResult(true, result);
+ if (result.isException()) throw result.getException();
+ return new SimpleInvocationResult(result.isNormal(),
result.getResult());
} finally {
Thread.currentThread().setContextClassLoader(originalLoader);