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

Matthew Swift
05.37.2011 6e38a25bcc15a6127574925d6675a17d9f24d0b4
Minor optimization: avoid creating a new unmodifiable wrapper if the object is already unmodifiable.
2 files modified
19 ■■■■ changed files
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java 10 ●●●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java 9 ●●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Attributes.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
@@ -614,7 +615,14 @@
  public static final Attribute unmodifiableAttribute(final Attribute attribute)
      throws NullPointerException
  {
    return new UnmodifiableAttribute(attribute);
    if (attribute instanceof UnmodifiableAttribute)
    {
      return attribute;
    }
    else
    {
      return new UnmodifiableAttribute(attribute);
    }
  }
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Entries.java
@@ -753,7 +753,14 @@
  public static Entry unmodifiableEntry(final Entry entry)
      throws NullPointerException
  {
    return new UnmodifiableEntry(entry);
    if (entry instanceof UnmodifiableEntry)
    {
      return entry;
    }
    else
    {
      return new UnmodifiableEntry(entry);
    }
  }