Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 890532 - NullPointerException raised in AMQDestination.equals method
NullPointerException raised in AMQDestination.equals method
Status: CLOSED ERRATA
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-java (Show other bugs)
2.2
All All
medium Severity medium
: 3.0
: ---
Assigned To: Rajith Attapattu
Valiantsina Hubeika
: EasyFix, Patch, TestCaseProvided
: 853197 (view as bug list)
Depends On:
Blocks: 956764
  Show dependency treegraph
 
Reported: 2012-12-27 10:07 EST by Pavel Moravec
Modified: 2014-09-24 11:05 EDT (History)
5 users (show)

See Also:
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.
Story Points: ---
Clone Of:
: 956764 (view as bug list)
Environment:
Last Closed: 2014-09-24 11:05:59 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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


External Trackers
Tracker ID Priority Status Summary Last Updated
Apache JIRA QPID-3760 None None None Never
Apache JIRA QPID-3769 None None None Never
Red Hat Product Errata RHEA-2014:1296 normal SHIPPED_LIVE Red Hat Enterprise MRG Messaging 3.0 Release 2014-09-24 15:00:06 EDT

  None (edit)
Description Pavel Moravec 2012-12-27 10:07:59 EST
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 10:09:50 EST
Created attachment 669620 [details]
reproducer
Comment 2 Pavel Moravec 2012-12-27 10:11:31 EST
Created attachment 669622 [details]
Proposed patch

Proposed patch.
Comment 3 Weston M. Price 2013-01-04 11:34:59 EST
*** Bug 853197 has been marked as a duplicate of this bug. ***
Comment 5 Weston M. Price 2013-01-10 11:39:50 EST
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 11:55:20 EDT
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 10:46:23 EDT
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 11:05:59 EDT
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.