src/share/classes/javax/management/ObjectName.java
Print this page
*** 827,837 ****
canonical_chars[prop_index++] = ',';
canonical_chars[prop_index++] = '*';
}
// we now build the canonicalname string
! _canonicalName = (new String(canonical_chars, 0, prop_index)).intern();
}
/**
* Parse a key.
* <pre>final int endKey=parseKey(s,startKey);</pre>
--- 827,837 ----
canonical_chars[prop_index++] = ',';
canonical_chars[prop_index++] = '*';
}
// we now build the canonicalname string
! _canonicalName = (new String(canonical_chars, 0, prop_index));
}
/**
* Parse a key.
* <pre>final int endKey=parseKey(s,startKey);</pre>
*** 1776,1793 ****
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
- // 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.
--- 1776,1789 ----
if (this == object) return true;
// object is not an object name case
if (!(object instanceof ObjectName)) return false;
ObjectName on = (ObjectName) object;
String on_string = on._canonicalName;
! if(_canonicalName.compareTo(on_string) == 0) return true;
return false;
}
/**
* Returns a hash code for this object name.