summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/binding-jms-runtime
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-02-13 12:33:53 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-02-13 12:33:53 +0000
commit2baba4611afa59bc74b06a082950fec0697a61b5 (patch)
tree4aa86726f97efb7a5d742b7e1ebe7da6c693c6ea /branches/sca-java-1.x/modules/binding-jms-runtime
parentf6f6425ae740d65c3e87a9c04ce66affdc53f55e (diff)
Change XMLTextMessageProcessor to override the createFaultMessage to handle FaultExceptions
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@744098 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-jms-runtime')
-rw-r--r--branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java
index 47adb27cf9..c453b20c5d 100644
--- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java
+++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java
@@ -32,7 +32,9 @@ import javax.xml.stream.XMLStreamReader;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
/**
* MessageProcessor for sending/receiving XML javax.jms.TextMessage with the JMSBinding.
@@ -92,5 +94,26 @@ public class XMLTextMessageProcessor extends AbstractMessageProcessor {
throw new JMSBindingException(e);
}
}
+
+ @Override
+ public Message createFaultMessage(Session session, Throwable o) {
+ if (session == null) {
+ logger.fine("no response session to create fault message: " + String.valueOf(o));
+ return null;
+ }
+ if (o instanceof FaultException) {
+ try {
+ TextMessage message = session.createTextMessage();
+ message.setText(String.valueOf(((FaultException)o).getFaultInfo()));
+ message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
+ return message;
+
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
+ } else {
+ return super.createFaultMessage(session, o);
+ }
+ }
}