1 Reply Latest reply on Jan 4, 2006 9:58 AM by tom.elrod

    TransporterClient exception handling

    mabacro

      Since the transporters use the Java reflection API to make remote calls and the "invoke" method of the class "Method" wraps all user defined exceptions of the underlying method in an "InvocationTargetException", I think it would be useful to catch this exception in the TransporterClient and rethrow only the user defined exception. In this case the user of the TransporterClient would only see his own exceptions and must not care about the exceptions thrown by the reflection API.

      public Object invoke(Object proxy, Method method, Object[] args)
       throws Throwable {
       String methodName = method.getName();
       String[] paramSig = createParamSignature(method.getParameterTypes());
       NameBasedInvocation request = new NameBasedInvocation(methodName, args,
       paramSig);
      
       try {
       return remotingClient.invoke(request);
       } catch (InvocationTargetException e) {
       throw e.getCause();
       }
      
      
       }
      


      Any suggestions on this would be appreciated.

      Regards,

      Marijo