Hide Forgot
Description of problem: When creating a connection factory, you have the option of setting the connection information through setters or through the constructor with an AMQConnectionURL. Using the setter methods isn't fully implemented in the sense that internal calls use the connectionDetails reference and this isn't updated when the setter methods are used. While working with a tool to write the information to LDAP, I encountered this issue as I was trying to dynamically provide the LDAP information piecemeal. Version-Release number of selected component (if applicable): 1.3 How reproducible: Create a AMQConnectionFactory object, set values using setter methods, then try binding to an LDAP context - this calls getReference which throws an NPE because it is looking at the local connectionDetails variable - which is of course null. So using the setter methods doesn't matter at all. Steps to Reproduce: AMQConnectionFactory factory = new AMQConnectionFactory(); factory.setHost("someHost"); factory.setPort(11111); factory.setDefaultUsername("username"); factory.setDefaultPassword("password"); factory.getReference(). Actual results: NullPointerException Expected results: No NullPointerException, reference handled properly Additional info: I would be more than happy to provide a sample change if you are interested, just let me know. It looks slightly hairy because of the prevelance of connectionDetails. Perhaps not allow the setters and just go with the a ConnectionURL constructor and a multi-parameter constructor for building the URL?
I agree that the setters should probably be removed as they make this class inherently unsafe. We should really require that a connection string be used all the time via the constructor and remove the other constructors as well.