[ 
https://issues.apache.org/jira/browse/TUSCANY-3698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12916454#action_12916454
 ] 

Scott Kurz commented on TUSCANY-3698:
-------------------------------------

The original behavior was the design, (sort of).   We had in mind the case 
where a non-Tuscany JMS consumer tries to receive the JMS Message, and it might 
not have access to any SCA-specific classes in its environment.

That said, along these lines I'd think we should be accomplishing this by 
setting a generic java.lang.RuntimeException into the message rather than 
ServiceRuntimeException, so maybe as it's coded it's not all that different.

There was much discussion about exception handling over binding.jms.  At first 
it might seem odd that the checked exc is treated different but as part of the 
"contract" it is more reasonable that any "client" environment would have to 
account for the checked exception.

Since we brought this up, I'd suggest switching to RuntimeException.

Scott

> JMS Binding erases the stack trace of RuntimeException's
> --------------------------------------------------------
>
>                 Key: TUSCANY-3698
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3698
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA JMS Binding Extension
>    Affects Versions: 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
>         Environment: Tuscany Java SCA 1.6
> Windows XP SP3
> JDK 1.6
>            Reporter: Padraig Myers
>             Fix For: Java-SCA-1.6, Java-SCA-2.0-M5
>
>         Attachments: Patch_TUSCANY-3698
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to