| Summary: | AMQDestination equals() validation is broken for addresses | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise MRG | Reporter: | Siddhesh Poyarekar <spoyarek> | ||||||
| Component: | qpid-java | Assignee: | Rajith Attapattu <rattapat+nobody> | ||||||
| Status: | CLOSED ERRATA | QA Contact: | Irina Boverman <iboverma> | ||||||
| Severity: | medium | Docs Contact: | |||||||
| Priority: | medium | ||||||||
| Version: | 2.0 | CC: | eallen, iboverma, jross, jshepherd, lzhaldyb, mnewsome, sauchter | ||||||
| Target Milestone: | 3.0 | Keywords: | Patch | ||||||
| Target Release: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | qpid-java-0.22 | 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 resulting in a null pointer exception if equals was called beforehand. The fix now handles equals and hashcode separately for ADDR and BURL, which allow the equals and hashcode methods to behave as expected.
|
Story Points: | --- | ||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2014-09-24 15:03:51 UTC | Type: | --- | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Attachments: |
|
||||||||
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. Committed another fix at rev http://svn.apache.org/r1461324 *** Bug 958360 has been marked as a duplicate of this bug. *** Verified on all supported platforms. Test case was included in the patch. The issue has been fixed, tested on RHEL 5.9 / 5.10 / 6.4 / 6.5 / i[36]86 / x86_64 on packages: qpid-java-0.22 Created attachment 809540 [details]
Tar file containing test program source and test execution script.
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 |
Created attachment 557221 [details] Fix AMQDestination validation Description of problem: AMQDestination has null values for _exchangeClass and _exchangeName if it is initialized with an address and checked for equality, one gets a NullPointerException. Version-Release number of selected component (if applicable): qpid-java-0.10-6.el5 How reproducible: Always Steps to Reproduce: Compile and run: import javax.jms.Destination; import javax.naming.*; import java.util.Properties; public class DestinationTest { public static void main(String[] args) throws Exception { Properties props = new Properties(); props.setProperty("java.naming.factory.initial", "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"); props.setProperty("destination.address1", "address1"); props.setProperty("destination.address2", "address2"); Context ctx = new InitialContext(props); Destination a1 = (Destination) ctx.lookup("address1"); Destination a2 = (Destination) ctx.lookup("address2"); if (a1.equals(a2)) throw new Exception("No Exception and addresses are equal"); else System.out.println("No exceptions"); } } Actual results: Exception in thread "main" java.lang.NullPointerException at org.apache.qpid.client.AMQDestination.equals(AMQDestination.java:577) at DestinationTest.main(DestinationTest.java:15) Expected results: No exception Additional info: Attached patch fixes validation for address strings and even between addresses that have different types and hence also fixes the NullPointerException.