From d33c0c2b7141ed9dbf02e01ff094e6b0342275da Mon Sep 17 00:00:00 2001 From: antelder Date: Mon, 30 Aug 2010 07:24:33 +0000 Subject: Update jms conection factory look up to check the type of the looked up object git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@990711 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sca-java-2.x/trunk/modules/binding-jms-runtime/src') diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java index 61080516b3..c0f063d377 100644 --- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java +++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java @@ -128,10 +128,14 @@ public class JMSResourceFactoryImpl implements JMSResourceFactory { } protected void createConnection() throws NamingException, JMSException { - ConnectionFactory connectionFactory = (ConnectionFactory)jndiLookUp(connectionFactoryName); - if (connectionFactory == null) { + Object o = jndiLookUp(connectionFactoryName); + if (o == null) { throw new JMSBindingException("connection factory not found: " + connectionFactoryName); } + if (!(o instanceof ConnectionFactory)) { + throw new JMSBindingException("JNDI resource '" + connectionFactoryName +"' is not a JMS ConnectionFactory"); + } + ConnectionFactory connectionFactory = (ConnectionFactory)o; connection = connectionFactory.createConnection(); } -- cgit v1.2.3