mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Nicolas Capponi
16.35.2015 e7a3a910de35ad3d576f09a738a4c1512ff5913c
OPENDJ-1645 CR-5805 Use name instead of oid to for hash code of schema elements

oid is modified during bootstrap of server, whereas name is always the same

3 files modified
17 ■■■■ changed files
opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java 9 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestCommonSchemaElements.java 6 ●●●● patch | view | raw | blame | history
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestObjectClass.java 2 ●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2013-2014 ForgeRock AS
 *      Portions Copyright 2013-2015 ForgeRock AS
 */
package org.opends.server.types;
@@ -145,8 +145,6 @@
    this.description = description;
    this.isObsolete = isObsolete;
    hashCode = oid.hashCode();
    // Make sure we have a primary name if possible.
    if (primaryName == null) {
      if (names != null && !names.isEmpty()) {
@@ -159,6 +157,9 @@
    }
    this.lowerName = toLowerCase(primaryName);
    // OPENDJ-1645: oid changes during server bootstrap, so prefer using name if available
    hashCode = getNameOrOID().hashCode();
    // Construct the normalized attribute name mapping.
    if (names != null) {
      this.names = new LinkedHashMap<String, String>(names.size());
@@ -525,7 +526,7 @@
    if (o instanceof CommonSchemaElements) {
      CommonSchemaElements other = (CommonSchemaElements) o;
      return oid.equals(other.oid);
      return getNameOrOID().equals(other.getNameOrOID());
    }
    return false;
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestCommonSchemaElements.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 *      Portions Copyright 2014-2015 ForgeRock AS
 */
package org.opends.server.types;
@@ -351,8 +351,8 @@
  public final Object[][] createEqualsTestData() {
    return new Object[][] {
        { "testType", "1.2.3", "testType", "1.2.3", true },
        { "testType", "1.2.3", "xxx", "1.2.3", true },
        { "testType", "1.2.3", "testType", "1.2.4", false },
        { "testType", "1.2.3", "xxx", "1.2.3", false },
        { "testType", "1.2.3", "testType", "1.2.4", true },
        { "testType", "1.2.3", "xxx", "1.2.4", false } };
  }
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestObjectClass.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2013-2014 ForgeRock AS
 *      Portions Copyright 2013-2015 ForgeRock AS
 */
package org.opends.server.types;