This is an automated email from the ASF dual-hosted git repository. billblough pushed a commit to branch transport in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-transports.git
commit 7a93c7d45198c5aec97ba0618f87a47d99cd651a Author: Ruwan Linton <ru...@apache.org> AuthorDate: Tue Oct 13 14:47:23 2009 +0000 Completing the fix for the WSCOMMONS-468 --- .../axis2/transport/jms/JMSConnectionFactory.java | 10 ++++++- .../axis2/transport/jms/JMSOutTransportInfo.java | 35 +++++++++++++++++++--- .../org/apache/axis2/transport/jms/JMSUtils.java | 10 +++---- .../axis2/transport/jms/ServiceTaskManager.java | 9 ++++-- 4 files changed, 51 insertions(+), 13 deletions(-) diff --git a/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSConnectionFactory.java b/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSConnectionFactory.java index f7fe745..250f389 100644 --- a/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSConnectionFactory.java +++ b/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSConnectionFactory.java @@ -173,7 +173,15 @@ public class JMSConnectionFactory { * @return JMS Destination for the given JNDI name or null */ public Destination getDestination(String destinationName, String destinationType) { - return JMSUtils.lookupDestination(context, destinationName, destinationType); + try { + return JMSUtils.lookupDestination(context, destinationName, destinationType); + } catch (NamingException e) { + handleException("Error looking up the JMS destination with name " + destinationName + + " of type " + destinationType, e); + } + + // never executes but keeps the compiler happy + return null; } /** diff --git a/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSOutTransportInfo.java b/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSOutTransportInfo.java index 41c892f..b047ed9 100644 --- a/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSOutTransportInfo.java +++ b/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSOutTransportInfo.java @@ -166,7 +166,16 @@ public class JMSOutTransportInfo implements OutTransportInfo { log.debug("Lookup the JMS destination " + destinationName + " of type " + destinationType + " extracted from the URL " + url); } - return JMSUtils.lookupDestination(context, destinationName, destinationType); + + try { + return JMSUtils.lookupDestination(context, destinationName, destinationType); + } catch (NamingException e) { + handleException("Couldn't locate the JMS destination " + destinationName + + " of type " + destinationType + " extracted from the URL " + url); + } + + // never executes but keeps the compiler happy + return null; } /** @@ -182,7 +191,16 @@ public class JMSOutTransportInfo implements OutTransportInfo { log.debug("Lookup the JMS destination " + replyDestinationName + " of type " + replyDestinationType + " extracted from the URL " + url); } - return JMSUtils.lookupDestination(context, replyDestinationName, replyDestinationType); + + try { + return JMSUtils.lookupDestination(context, replyDestinationName, replyDestinationType); + } catch (NamingException e) { + handleException("Couldn't locate the JMS destination " + replyDestinationName + + " of type " + replyDestinationType + " extracted from the URL " + url); + } + + // never executes but keeps the compiler happy + return null; } /** @@ -195,8 +213,17 @@ public class JMSOutTransportInfo implements OutTransportInfo { log.debug("Lookup the JMS destination " + replyDest + " of type " + replyDestinationType); } - return JMSUtils.lookupDestination( - jmsConnectionFactory.getContext(), replyDest, replyDestinationType); + + try { + return JMSUtils.lookupDestination( + jmsConnectionFactory.getContext(), replyDest, replyDestinationType); + } catch (NamingException e) { + handleException("Couldn't locate the JMS destination " + replyDest + + " of type " + replyDestinationType); + } + + // never executes but keeps the compiler happy + return null; } diff --git a/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSUtils.java b/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSUtils.java index eae3525..3b85c1f 100644 --- a/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSUtils.java +++ b/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSUtils.java @@ -698,7 +698,7 @@ public class JMSUtils extends BaseUtils { * @return the JMS destination, or null if it does not exist */ public static Destination lookupDestination(Context context, String destinationName, - String destinationType) { + String destinationType) throws NamingException { if (destinationName == null) { return null; @@ -712,12 +712,12 @@ public class JMSUtils extends BaseUtils { (JMSConstants.DESTINATION_TYPE_TOPIC.equals(destinationType) ? "dynamicTopics/" : "dynamicQueues/") + destinationName); } catch (NamingException x) { - handleException("Cannot locate destination : " + destinationName); + log.warn("Cannot locate destination : " + destinationName); + throw x; } } catch (NamingException e) { - handleException("Cannot locate destination : " + destinationName, e); + log.warn("Cannot locate destination : " + destinationName, e); + throw e; } - - return null; } } diff --git a/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/ServiceTaskManager.java b/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/ServiceTaskManager.java index 0d4dcc1..b44a827 100644 --- a/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/ServiceTaskManager.java +++ b/1.0.0/modules/jms/src/main/java/org/apache/axis2/transport/jms/ServiceTaskManager.java @@ -864,13 +864,15 @@ public class ServiceTaskManager { /** * Return the JMS Destination for the JNDI name of the Destination from the InitialContext + * @param session which is used to create the destinations if not present and if possible * @return the JMS Destination to which this STM listens for messages */ private Destination getDestination(Session session) { if (destination == null) { try { context = getInitialContext(); - destination = JMSUtils.lookup(context, Destination.class, getDestinationJNDIName()); + destination = JMSUtils.lookupDestination(context, getDestinationJNDIName(), + JMSUtils.getDestinationTypeAsString(destinationType)); if (log.isDebugEnabled()) { log.debug("JMS Destination with JNDI name : " + getDestinationJNDIName() + " found for service " + serviceName); @@ -893,8 +895,9 @@ public class ServiceTaskManager { } } } catch (JMSException j) { - handleException("Error looking up and creating JMS destination : " + - getDestinationJNDIName() + " using JNDI properties : " + jmsProperties, e); + handleException("Error looking up JMS destination and auto " + + "creating JMS destination : " + getDestinationJNDIName() + + " using JNDI properties : " + jmsProperties, e); } } }