Author: ruwan Date: Tue Oct 13 14:47:28 2009 New Revision: 824795 URL: http://svn.apache.org/viewvc?rev=824795&view=rev Log: Completing the fix for the WSCOMMONS-468
Modified: webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSConnectionFactory.java webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSOutTransportInfo.java webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSUtils.java webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/ServiceTaskManager.java Modified: webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSConnectionFactory.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSConnectionFactory.java?rev=824795&r1=824794&r2=824795&view=diff ============================================================================== --- webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSConnectionFactory.java (original) +++ webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSConnectionFactory.java Tue Oct 13 14:47:28 2009 @@ -173,7 +173,15 @@ * @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; } /** Modified: webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSOutTransportInfo.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSOutTransportInfo.java?rev=824795&r1=824794&r2=824795&view=diff ============================================================================== --- webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSOutTransportInfo.java (original) +++ webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSOutTransportInfo.java Tue Oct 13 14:47:28 2009 @@ -166,7 +166,16 @@ 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 @@ 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 @@ 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; } Modified: webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSUtils.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSUtils.java?rev=824795&r1=824794&r2=824795&view=diff ============================================================================== --- webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSUtils.java (original) +++ webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSUtils.java Tue Oct 13 14:47:28 2009 @@ -698,7 +698,7 @@ * @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 @@ (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; } } Modified: webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/ServiceTaskManager.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/ServiceTaskManager.java?rev=824795&r1=824794&r2=824795&view=diff ============================================================================== --- webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/ServiceTaskManager.java (original) +++ webservices/commons/trunk/modules/transport/modules/jms/src/main/java/org/apache/axis2/transport/jms/ServiceTaskManager.java Tue Oct 13 14:47:28 2009 @@ -864,13 +864,15 @@ /** * 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 @@ } } } 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); } } }