You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ar...@apache.org on 2007/10/19 17:02:41 UTC

svn commit: r586491 - /incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java

Author: arnaudsimon
Date: Fri Oct 19 08:02:40 2007
New Revision: 586491

URL: http://svn.apache.org/viewvc?rev=586491&view=rev
Log:
Changed to handle exception correctly in onMessage

Modified:
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java?rev=586491&r1=586490&r2=586491&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java Fri Oct 19 08:02:40 2007
@@ -127,8 +127,14 @@
                 getSession().getAMQConnection().getExceptionListener()
                         .onException(new JMSAMQException("Error when receiving message", e));
             }
-            catch (JMSException e1)
+            catch (Exception e1)
             {
+                // the receiver may be waiting for a message
+                if( _messageCounter.get() >= 0)
+                {
+                    _messageCounter.decrementAndGet();
+                    _synchronousQueue.add(new NullTocken());
+                }
                 // we should silently log thie exception as it only hanppens when the connection is closed
                 _logger.error("Exception when receiving message", e1);
             }
@@ -261,7 +267,7 @@
         // TODO Use a tag for fiding out if message filtering is done here or by the broker.
         try
         {
-            if (getMessageSelector() != null)
+            if (getMessageSelector() != null && ! getMessageSelector().equals(""))
             {
                 messageOk = _filter.matches(message);
             }