adc 2004/02/16 10:26:26
Modified: modules/remoting/src/java/org/apache/geronimo/remoting
DeMarshalingInterceptor.java
MarshalingInterceptor.java
Log:
Re-aligned the code to be more closely to how it was before but with the
bug fix still in. Others can decide if it makes sense to send the exception
back across to the client.
Revision Changes Path
1.6 +12 -5
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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DeMarshalingInterceptor.java 16 Feb 2004 17:51:02 -0000 1.5
+++ DeMarshalingInterceptor.java 16 Feb 2004 18:26:26 -0000 1.6
@@ -79,6 +79,13 @@
this.classloader = classloader;
}
+ public static class ThrowableWrapper implements Serializable {
+ ThrowableWrapper(Throwable exception) {
+ this.exception = exception;
+ }
+ public Throwable exception;
+ }
+
/**
* @return
*/
@@ -105,17 +112,17 @@
marshalledInvocation = (Invocation) mo.get();
} catch (Throwable e) {
// Could not deserialize the invocation...
- mo.set(e);
+ mo.set(new ThrowableWrapper(e));
return new SimpleInvocationResult(false, mo);
}
try {
InvocationResult rc = next.invoke(marshalledInvocation);
- mo.set(rc);
+ mo.set(new SimpleInvocationResult(rc.isNormal(),
rc.getResult()));
return new SimpleInvocationResult(true, mo);
} catch (Throwable e) {
- mo.set(e);
- return new SimpleInvocationResult(false, mo);
+ mo.set(new ThrowableWrapper(e));
+ return new SimpleInvocationResult(true, mo);
}
} finally {
1.5 +8 -6
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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MarshalingInterceptor.java 16 Feb 2004 17:51:02 -0000 1.4
+++ MarshalingInterceptor.java 16 Feb 2004 18:26:26 -0000 1.5
@@ -84,22 +84,24 @@
InvocationResult rc = next.invoke(invocation);
- // Demarshal the result.
+ // Demarshal the obj.
mo = (MarshalledObject) rc.getResult();
- InvocationResult result;
+ Object obj;
try {
- result = (InvocationResult)mo.get();
+ obj = mo.get();
} catch ( ClassNotFoundException e ) {
// Weird.
Thread.currentThread().setContextClassLoader(MarshalingInterceptor.class.getClassLoader());
- result = (InvocationResult)mo.get();
+ obj = mo.get();
}
// Are we demarshalling a thrown exception.
- if (result.isException()) throw result.getException();
- return new SimpleInvocationResult(result.isNormal(),
result.getResult());
+ if (obj instanceof DeMarshalingInterceptor.ThrowableWrapper) {
+ throw ((DeMarshalingInterceptor.ThrowableWrapper)
obj).exception;
+ }
+ return (InvocationResult)obj;
} finally {
Thread.currentThread().setContextClassLoader(originalLoader);