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

JMS Binding erases the stack trace of RuntimeException's

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Java-SCA-1.5, Java-SCA-1.5.1, Java-SCA-1.6, Java-SCA-2.0-M1, Java-SCA-2.0-M2, Java-SCA-2.0-M3, Java-SCA-2.0-M4, Java-SCA-2.0-M5
    • Java-SCA-1.6, Java-SCA-2.0-M5
    • None
    • Tuscany Java SCA 1.6
      Windows XP SP3
      JDK 1.6
    • Patch Available

    Description

      In the file org.apache.tuscany.sca.binding.jms.provider.AbstractMessageProcessor there is a method createFaultMessage(), this method creates a JMS fault message from an exception that is passed into the method.
      However if the messages is a RuntimeException a new exception is created, thereby losing the stack trace from the original exception.
      The offending piece of code is
      ObjectMessage message = session.createObjectMessage();
      String causeMsg;
      if (o instanceof RuntimeException)

      { message.setObject(new ServiceRuntimeException(o.getMessage())); }

      else

      { // for a checked exception return the checked exception message.setObject(o); }

      message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
      return message;

      there is no reason that RuntimeException's should be treated any differently and therefore the code above can be replaced with
      ObjectMessage message = session.createObjectMessage();
      message.setObject(o);
      message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
      return message;

      This means that the component that gets this JMS message will be able to log the true source of the exception and not lose all the stack trace information.

      Attachments

        1. 3698.padraig.ver2.patch
          2 kB
          Padraig Myers
        2. 3698.skurz.patch
          2 kB
          Scott Kurz
        3. Patch_TUSCANY-3698
          0.8 kB
          Padraig Myers

        Activity

          People

            Unassigned Unassigned
            padraigmyers Padraig Myers
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: