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.
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