src/share/classes/javax/management/ObjectName.java

Print this page

        

@@ -827,11 +827,11 @@
                 canonical_chars[prop_index++] = ',';
             canonical_chars[prop_index++] = '*';
         }
 
         // we now build the canonicalname string
-        _canonicalName = (new String(canonical_chars, 0, prop_index)).intern();
+        _canonicalName = (new String(canonical_chars, 0, prop_index));
     }
 
     /**
      * Parse a key.
      * <pre>final int endKey=parseKey(s,startKey);</pre>

@@ -1776,18 +1776,14 @@
         if (this == object) return true;
 
         // object is not an object name case
         if (!(object instanceof ObjectName)) return false;
 
-        // equality when canonical names are the same
-        // (because usage of intern())
         ObjectName on = (ObjectName) object;
         String on_string = on._canonicalName;
-        if (_canonicalName == on_string) return true;  // ES: OK
+        if(_canonicalName.compareTo(on_string) == 0) return true;
 
-        // Because we are sharing canonical form between object names,
-        // we have finished the comparison at this stage ==> unequal
         return false;
    }
 
     /**
      * Returns a hash code for this object name.