Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-1802

RMI Implementation Error Handling lost inner exception's detail information

    XMLWordPrintableJSON

Details

    • Patch Available

    Description

      Here is an email I sent to the tuscany user group. Raymond Feng confirms it may be a potential bug. Please have a look.

      /--------------------------------------
      Hi,

      I am a new user of Tuscany and I am very excited with this great software. I am trying to introduce it into my project and currently I am evaluate it with every possible situations.
      Currently, I met a small problem with the spring implementation. I am not sure if I understand the background and configure the composites right. Please correct me if I make anything wrong.
      The problem I met is that I cannot get the detailed original exception when the server-side throw any kinds of exceptions. After a rough looking at the src code and debugging, I see the following code in SpringInvoker.java :
      -----------------------------------------------------------------------
      private Object doInvoke(Object payload) throws SpringInvocationException {
      if (theMethod == null)
      setupMethod();

      if (badInvoker)
      throw new SpringInvocationException("Spring invoker incorrectly configured");
      // Invoke the method on the Spring bean using the payload, returning the results
      try {
      Object ret;

      if (payload != null && !payload.getClass().isArray())

      { ret = theMethod.invoke(bean, payload); }

      else

      { ret = theMethod.invoke(bean, (Object[])payload); }

      return ret;
      } catch (InvocationTargetException e)

      { throw new SpringInvocationException(e.getMessage()); }

      catch (Exception e)

      { throw new SpringInvocationException(e.getMessage()); }

      } // end method doInvoke
      ------------------------------------------------------------------------
      When the invoked method throw an exception (checked or unchecked), the program flow will go to the InvocationTargetException exception handler. Then the program only put the message of the original message to the wrapper exception SpringInvocationException. The detailed information of the original exception is missing. I am thinking it is here that will lost the detailed information of the original exception detail.

      The reason for me to bring this question is that if we cannot get the detailed information of the original exception, how can we deal with the application exceptions (such as NotEnoughMoneyException)? The only thing I can get is the java.lang.reflect.InvocationTargetException wrapped in java.rmi.UnexpectedException. And with those information, I cannot get the right information to make the further decision in the program.

      I am not sure whether I got the right point or if I misunderstand anything. Please give me some suggestions on this problem.

      Best Regards,
      Yang Sun
      --------------------------------------------------------------------------------/

      Attachments

        1. 1802.patch
          4 kB
          wangfeng

        Activity

          People

            simonslaws Simon Laws
            syyzxsyf Yang Sun
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: