Bug 784970

Summary: When creating an Address using a toString() of another address object, "None" is used as the subject when it should be Null
Product: Red Hat Enterprise MRG Reporter: Rajith Attapattu <rattapat+nobody>
Component: qpid-javaAssignee: Rajith Attapattu <rattapat+nobody>
Status: CLOSED CURRENTRELEASE QA Contact: MRG Quality Engineering <mrgqe-bugs>
Severity: low Docs Contact:
Priority: high    
Version: DevelopmentCC: iboverma, jpechane, jross
Target Milestone: 2.1.2   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-jca-0.14-6 Doc Type: Bug Fix
Doc Text:
Cause: 'None' is used instead of an empty subject for the toString() output of an addres. Consequence: If the toString() is used to create another address, the new address will interpret 'None' as the subject. Fix: The code will treat 'None' as empty when creating an address from a string. Result: You could now create an address correctly using the toString() of another address.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Rajith Attapattu 2012-01-26 19:43:56 UTC
Description of problem:

This issue was identified due to a TCK failure.
When the TCK was comparing the toString() of the original destination to the one it used in a QueueBrowser, the test failed. Upon closer inspection a subtle change was noted.

Original destination toString()
'MY_QUEUE'/None; {
  'create': 'always'
} 

The destination created by using the toString()
'MY_QUEUE'/'None'; {
  'create': 'always'
}

Notice the None is quoted in the second string. The code prints None in place of a Null subject to make an address string more readable. Therefore if a new destination is created from a toString() of a destination, the code needs to identify the 'None' in the subject field as null.

Version-Release number of selected component (if applicable):
All release java rpms which supports addressing

How reproducible:
Always

Steps to Reproduce:
Address addr = Address.parse("MY_QUEUE; {create : always}");
System.out.println("Addr1 : " + addr);
		
Address addr2 = Address.parse(addr.toString());
System.out.println("Addr2 : " + addr2);
  
Actual results:
'MY_QUEUE'/'None'; {
  'create': 'always'
}

Expected results:
'MY_QUEUE'/None; {
  'create': 'always'
}

Additional info:
Note the missing quotes around "None" in the expected results when comparing with actual results.

Comment 1 Rajith Attapattu 2012-01-26 19:46:26 UTC
This is covered in upstream via QPID-3783
A fix has been committed at http://svn.apache.org/viewvc?view=rev&rev=1236196

Comment 2 Jiri Pechanec 2012-02-24 07:42:11 UTC
Verified in 0.14-8

Comment 3 Rajith Attapattu 2012-03-12 15:23:28 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: 'None' is used instead of an empty subject for the toString() output of an addres.

Consequence:  If the toString() is used to create another address, the new address will interpret 'None' as the subject.

Fix:  The code will treat 'None' as empty when creating an address from a string.

Result: You could now create an address correctly using the toString() of another address.