Bug 890532 - NullPointerException raised in AMQDestination.equals method
Summary: NullPointerException raised in AMQDestination.equals method
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-java
Version: 2.2
Hardware: All
OS: All
medium
medium
Target Milestone: 3.0
: ---
Assignee: Rajith Attapattu
QA Contact: Valiantsina Hubeika
URL:
Whiteboard:
: 853197 (view as bug list)
Depends On:
Blocks: 956764
TreeView+ depends on / blocked
 
Reported: 2012-12-27 15:07 UTC by Pavel Moravec
Modified: 2018-12-06 14:53 UTC (History)
5 users (show)

Fixed In Version: qpid-java-0.22-1.el5, qpid-java-0.22-2.el6
Doc Type: Bug Fix
Doc Text:
It was discovered that the AMQDestination.equals method did not take into account the differences between the ADDR and BURL syntax. The legacy fields were not populated until the address was validated, which resulted in a null pointer exception if equals was called beforehand.The fix now handles equals and hashcode separately for ADDR and BURL, which now allow the equals and and hashcode methods to behave as expected.
Clone Of:
: 956764 (view as bug list)
Environment:
Last Closed: 2014-09-24 15:05:59 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
reproducer (5.19 KB, application/x-zip)
2012-12-27 15:09 UTC, Pavel Moravec
no flags Details
Proposed patch (1.04 KB, patch)
2012-12-27 15:11 UTC, Pavel Moravec
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Apache JIRA QPID-3760 0 None None None Never
Apache JIRA QPID-3769 0 None None None Never
Red Hat Product Errata RHEA-2014:1296 0 normal SHIPPED_LIVE Red Hat Enterprise MRG Messaging 3.0 Release 2014-09-24 19:00:06 UTC

Description Pavel Moravec 2012-12-27 15:07:59 UTC
Description of problem:
Running simple attached reproducer in maven, NPE is raised.


Version-Release number of selected component (if applicable):
0.18-2


How reproducible:
100%


Steps to Reproduce:
1. Install junit, spring-framework and maven
2. unzip attachment, optionally modify brokerlist in MrgmNpeTest-context.xml to whatever else than default "localhost"
3. mvn test
4. If repeating the test, ensure that maven repository contains proper jar files!!! It automatically tries to _download_ files from qpid.apache.org, ignoring whatever is installed. To replace maven repository, do:
cp -f /usr/share/java/qpid-common-0.18.jar /root/.m2/repository/org/apache/qpid/qpid-common/0.18/qpid-common-0.18.jar 
cp -f /usr/share/java/qpid-client-0.18.jar /root/.m2/repository/org/apache/qpid/qpid-client/0.18/qpid-client-0.18.jar
(and re-run the test with -o option to make maven offline)



Actual results:
-------------------------------------------------------------------------------
Test set: com.redhat.mrgm.npe.MrgmNpeTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.012 sec <<< FAILURE!
testNpe(com.redhat.mrgm.npe.MrgmNpeTest)  Time elapsed: 0.879 sec  <<< ERROR!
java.lang.NullPointerException
        at org.apache.qpid.client.AMQDestination.equals(AMQDestination.java:603)
        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:305)
        at org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.getCachedProducer(CachingConnectionFactory.java:353)
        at org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.invoke(CachingConnectionFactory.java:320)
        at $Proxy9.createProducer(Unknown Source)
        at org.springframework.jms.core.JmsTemplate.doCreateProducer(JmsTemplate.java:971)
        at org.springframework.jms.core.JmsTemplate.createProducer(JmsTemplate.java:952)
        at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:563)
        at org.springframework.jms.core.JmsTemplate$4.doInJms(JmsTemplate.java:546)
        at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:466)
        at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:543)
        at com.redhat.mrgm.npe.MrgmNpeTest.testNpe(MrgmNpeTest.java:34)
..


Expected results:
Test passes.


Additional info:
Simple patch proposed.

Comment 1 Pavel Moravec 2012-12-27 15:09:50 UTC
Created attachment 669620 [details]
reproducer

Comment 2 Pavel Moravec 2012-12-27 15:11:31 UTC
Created attachment 669622 [details]
Proposed patch

Proposed patch.

Comment 3 Weston M. Price 2013-01-04 16:34:59 UTC
*** Bug 853197 has been marked as a duplicate of this bug. ***

Comment 5 Weston M. Price 2013-01-10 16:39:50 UTC
Switching assignment as BZ-784270 appears to be a duplicate, or at the very least close to the same issue. As Rajith is looking at this makes sense for him to kill two birds with one stone...so to speak.

Comment 6 Rajith Attapattu 2013-03-13 15:55:20 UTC
Fixed in upstream  (QPID-3769)
http://svn.apache.org/r1456007
http://svn.apache.org/r1456008

Committed a slightly modified version of Siddesh's patch.
Added a fix to hashcode as well and added a test case.

Comment 7 Valiantsina Hubeika 2013-06-20 14:46:23 UTC
tested on packages:

qpid-java-common-0.22-2.el5
qpid-java-client-0.22-2.el5

&

qpid-java-common-0.22-3.el6.noarch
qpid-java-client-0.22-3.el6.noarch

Comment 10 errata-xmlrpc 2014-09-24 15:05:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-1296.html


Note You need to log in before you can comment on or make changes to this bug.