From d6c656f919cc307885a8de1c4becc945849d9f12 Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 12 Aug 2010 13:10:56 +0000 Subject: Validate that jndi lookup returns the expected jms destination type git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@984754 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/binding/jms/host/DefaultJMSServiceListener.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host') diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListener.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListener.java index 3bd7b8c345..2f5d2e2632 100644 --- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListener.java +++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListener.java @@ -214,6 +214,23 @@ public class DefaultJMSServiceListener implements JMSServiceListener { + " listener"); } + // Make sure its the expected type (queue or topic) + String type = (destination instanceof Queue) ? JMSBindingConstants.DESTINATION_TYPE_QUEUE : JMSBindingConstants.DESTINATION_TYPE_TOPIC; + if ("jndi".equals(jmsBinding.getDestinationType())) { + jmsBinding.setDestinationType(type); + } else { + if (!type.equals(jmsBinding.getDestinationType())) { + throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName() + + " expecting type of " + + jmsBinding.getDestinationType() + + " but found " + + type + + " while registering service " + + serviceName + + " listener"); + } + } + return destination; } -- cgit v1.2.3