geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/proxy ProxyContainer.java
Date Wed, 01 Oct 2003 02:30:16 GMT
ammulder    2003/09/30 19:30:16

  Modified:    modules/core/src/java/org/apache/geronimo/proxy
                        ProxyContainer.java
  Log:
  Unwrap "undeclared exceptions" from proxy invocations.
  While I'm in there, added some class-level JavaDoc.
  
  Revision  Changes    Path
  1.4       +14 -3     incubator-geronimo/modules/core/src/java/org/apache/geronimo/proxy/ProxyContainer.java
  
  Index: ProxyContainer.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/proxy/ProxyContainer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProxyContainer.java	8 Sep 2003 04:31:39 -0000	1.3
  +++ ProxyContainer.java	1 Oct 2003 02:30:16 -0000	1.4
  @@ -58,11 +58,18 @@
   import java.lang.reflect.InvocationHandler;
   import java.lang.reflect.Method;
   import java.lang.reflect.Proxy;
  +import java.lang.reflect.UndeclaredThrowableException;
   
   import org.apache.geronimo.core.service.Invocation;
   import org.apache.geronimo.core.service.InvocationResult;
   
   /**
  + * A local container that is a proxy for some other "real" container.
  + * This container is itself fairly unintelligent; you need to add some
  + * interceptors to get the desired behavior (i.e. contacting the real
  + * server on every request).  For example, see
  + * {@link org.apache.geronimo.remoting.jmx.RemoteMBeanServerFactory}
  + *
    * @version $Revision$ $Date$
    */
   public class ProxyContainer extends SimpleRPCContainer implements InvocationHandler {
  @@ -74,8 +81,12 @@
           Invocation invocation = new ProxyInvocation();
           ProxyInvocation.putMethod(invocation, method);
           ProxyInvocation.putArguments(invocation, args);
  -        InvocationResult result = this.invoke(invocation);
  -        return result.getResult();
  +        try {
  +            InvocationResult result = this.invoke(invocation);
  +            return result.getResult();
  +        } catch(UndeclaredThrowableException e) {
  +            throw e.getCause(); // It's useless to know we got an undeclared throwable,
we need the real thing!
  +        }
       }
   
       public Object createProxy(Class likeClass) {
  
  
  

Mime
View raw message