qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Azim Fatehi (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (QPID-3760) Unable to use address strings with java client due to NPE
Date Mon, 20 Aug 2012 21:31:38 GMT

    [ https://issues.apache.org/jira/browse/QPID-3760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13438229#comment-13438229
] 

Azim Fatehi edited comment on QPID-3760 at 8/21/12 8:29 AM:
------------------------------------------------------------

This bug renders it very difficult to use Apache Camel, as address strings and the spring
CachingConnectionFactory are a must. Following the style of the existing _queueName check,
I tried the patch which I've pasted below. I don't have any answer to Lar's comment about
null versus "" strings, but this patch seems to work for me.

{code}
--- /original/qpid-0.16/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java
2012-01-29 10:38:29.000000000 -0600
+++ /modified/qpid-0.16/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java
2012-08-16 15:29:27.329126287 -0500
@@ -600,11 +600,13 @@
 
         final AMQDestination that = (AMQDestination) o;
 
-        if (!_exchangeClass.equals(that._exchangeClass))
+        if ((_exchangeClass == null && that._exchangeClass != null) ||
+            (_exchangeClass != null && !_exchangeClass.equals(that._exchangeClass)))
         {
             return false;
         }
-        if (!_exchangeName.equals(that._exchangeName))
+        if ((_exchangeName == null && that._exchangeName != null) ||
+            (_exchangeName != null && !_exchangeName.equals(that._exchangeName)))
         {
             return false;
         }
{code}
                
      was (Author: waste):
    This bug renders it very difficult to use Apache Camel, as address strings and the spring
CachingConnectionFactory are a must. Following the style of the existing _queueName check,
I tried the patch which I've pasted below. I don't have any answer to Lar's comment about
null versus "" strings, but this patch seems to work for me.

--- /original/qpid-0.16/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java
2012-01-29 10:38:29.000000000 -0600
+++ /modified/qpid-0.16/java/client/src/main/java/org/apache/qpid/client/AMQDestination.java
2012-08-16 15:29:27.329126287 -0500
@@ -600,11 +600,13 @@
 
         final AMQDestination that = (AMQDestination) o;
 
-        if (!_exchangeClass.equals(that._exchangeClass))
+        if ((_exchangeClass == null && that._exchangeClass != null) ||
+            (_exchangeClass != null && !_exchangeClass.equals(that._exchangeClass)))
         {
             return false;
         }
-        if (!_exchangeName.equals(that._exchangeName))
+        if ((_exchangeName == null && that._exchangeName != null) ||
+            (_exchangeName != null && !_exchangeName.equals(that._exchangeName)))
         {
             return false;
         }

                  
> Unable to use address strings with java client due to NPE
> ---------------------------------------------------------
>
>                 Key: QPID-3760
>                 URL: https://issues.apache.org/jira/browse/QPID-3760
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: 0.10
>            Reporter: Sergey Zhemzhitsky
>              Labels: addressing
>
> Stacktrace:
> {code}
> Exception in thread "Thread-5" java.lang.NullPointerException
> 	at org.apache.qpid.client.AMQDestination.equals(AMQDestination.java:577)
> 	at org.springframework.jms.connection.CachingConnectionFactory$DestinationCacheKey.destinationEquals(CachingConnectionFactory.java:467)
> 	at org.springframework.jms.connection.CachingConnectionFactory$DestinationCacheKey.equals(CachingConnectionFactory.java:474)
> 	at java.util.HashMap.get(HashMap.java:385)
> 	at org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.getCachedProducer(CachingConnectionFactory.java:353)
> 	at org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.invoke(CachingConnectionFactory.java:320)
> 	at $Proxy1.createProducer(Unknown Source)
> {code}
> Exception happens for the following address:
> {code}
> JbenchQueue;{create: always, node: {type:queue}}
> {code}
> It seems the qpid java client tries to obtain exchangeClass property in AMQDestination.equals
method, but this property is not set when using address strings.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message