This rule flags the potential use of the double-slash, "//" in the domain part of javax.management.ObjectName constructors. JSR 255 plans to use "//" in the domain part of an javax.management.ObjectName as a separator for "cascading". While JSR 255 is not part of Java SE 6, it is recommended that the domain part of an ObjectName not contain the string "//" to avoid future compatibility issues.
ObjectNames are of the form:
domain:key1=value1,key2=value2,key3=value3,*with a variable number of key properties.
If your application contains MBeans with ObjectNames that have a domain name with a double slash, you will need to change the domain name for those MBeans.
This rule inspects ObjectName constructors and if possible checks the domain part of the string to verify there are no double slashes. It will be able to scan constructors that pass String literals or a final String variable that is defined in the same compilation unit. If it can inspect the domain name, it will only flag those constructors that violate the rule.
The rule will also flag instances of the ObjectName constructor that have the domain name coded as a variable that is not readily available for inspection. Manually inspect these instances to verify the domain names does not contain a double slash.
Example 1:
In Example 1, the rule will flag myObj1 and myObj3 since those strings contain "//". myObj2 will not be flagged.
Example 2:
In Example 2, the rule will flag myObj2 but not myObj1.
Example 3:
In Example 3, myObj will be flagged because the code cannot determine the domain name.
For additional information, see: