[jboss-cvs] JBoss Messaging SVN: r2580 - in trunk: src/main/org/jboss/jms/message and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 17 13:00:46 EDT 2007


Author: timfox
Date: 2007-04-17 13:00:46 -0400 (Tue, 17 Apr 2007)
New Revision: 2580

Modified:
   trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
   trunk/src/main/org/jboss/jms/message/JBossMessage.java
   trunk/tests/src/org/jboss/test/messaging/jms/message/JMSReplyToHeaderTest.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-622, also on connection consumer only log error on close after failure as trace


Modified: trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java	2007-04-17 15:23:29 UTC (rev 2579)
+++ trunk/src/main/org/jboss/jms/client/JBossConnectionConsumer.java	2007-04-17 17:00:46 UTC (rev 2580)
@@ -326,9 +326,19 @@
       //Calling session.closing() will cause the consumer to close which
       //will make any receive() calls return null
       //and not return until the consumer close protocol is complete
-      sess.closing();
-      sess.close();           
       
+      try
+      {      
+         sess.closing();
+         sess.close();
+      }
+      catch (Throwable t)
+      {
+         //Closing may fail if doClose() was called after a previous Throwable was caught hence
+         //only want to log in trace mode
+         log.trace("Failed to close session", t);
+      }
+      
       if (trace) { log.trace(this + "Closed message handler"); }
    }
 

Modified: trunk/src/main/org/jboss/jms/message/JBossMessage.java
===================================================================
--- trunk/src/main/org/jboss/jms/message/JBossMessage.java	2007-04-17 15:23:29 UTC (rev 2579)
+++ trunk/src/main/org/jboss/jms/message/JBossMessage.java	2007-04-17 17:00:46 UTC (rev 2580)
@@ -62,6 +62,7 @@
  * 
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:bershath at yahoo.com">Tyronne Wickramarathne</a>
  * 
  * Partially ported from JBossMQ implementation originally written by:
  * @author Norbert Lataille (Norbert.Lataille at m4x.org)
@@ -428,11 +429,19 @@
 
    public void setJMSReplyTo(Destination replyTo) throws JMSException
    {
-      if (!(replyTo instanceof JBossDestination))
+      //Need to be able to set null too
+      if (replyTo == null)
       {
-         throw new InvalidDestinationException("Replyto cannot be foreign");
+         headers.put(REPLYTO_HEADER_NAME, null);
       }
-      headers.put(REPLYTO_HEADER_NAME, (JBossDestination)replyTo);
+      else
+      {      
+         if (!(replyTo instanceof JBossDestination))
+         {
+            throw new InvalidDestinationException("Replyto cannot be foreign");
+         }
+         headers.put(REPLYTO_HEADER_NAME, (JBossDestination)replyTo);
+      }
    }
 
    public Destination getJMSDestination() throws JMSException

Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/JMSReplyToHeaderTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/JMSReplyToHeaderTest.java	2007-04-17 15:23:29 UTC (rev 2579)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/JMSReplyToHeaderTest.java	2007-04-17 17:00:46 UTC (rev 2580)
@@ -73,7 +73,19 @@
       assertEquals(tempQ, m.getJMSReplyTo());
    }
    
+   public void testJMSDestinationNull() throws Exception
+   {
+      Message m = queueProducerSession.createMessage();
+      m.setJMSReplyTo(null);
+      
+      queueProducer.send(m);
+      queueConsumer.receive();
+      assertNull(m.getJMSReplyTo());
+   }
    
+   
+   
+   
 
 
    // Package protected ---------------------------------------------




More information about the jboss-cvs-commits mailing list