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

neil_a_wilson
11.43.2007 ba04f8f7aeeea23a2b27dd68294d882e98481882
Make a number of relatively simple changes to provide basic performance
improvements, including:

- Replace occurrences of StringBuffer with StringBuilder. As of Java 5,
StringBuilder is almost always a better choice than StringBuffer because it
provides all the same methods but doesn't have the synchronization overhead.

- Update the JE backend DN2URI class (which is responsible for keeping track of
smart referrals in the database) to keep track of whether there are any
referrals in the underlying database so that it doesn't go to the DB if it
can be certain that there aren't any referrals to get.

- Update the JE backend ImportJob class to provide a simple cache for parent ID
lookups so that it can avoid the need to go to the underlying DB to get the
entry ID for a parent entry if it's contained in the cache.

- Update the salted password storage scheme variants so that they use an
instance of java.util.Random rather than java.security.SecureRandom to
generate the salt. There really isn't a need for a cryptographic-quality
random number generator for salt generation, and the java.util.Random
implementation is much faster than the java.security.SecureRandom
implementation.

- Update the DN class to return a reference to the precomputed NULL_DN instead
of creating a new DN with zero RDN components when decoding DNs from strings
or octet strings. Also, use LinkedList rather than ArrayList for temporary
storage of RDN values to avoid the hit of allocating memory that we may not
need.


- Update the Entry class to cache the result of LDIFImportConfig.typesOnly(),
which has been observed to slightly improve MakeLDIF performance.

- If Java 6 is available, then prefer using it to set file permissions over
Runtime.exec() on UNIX systems. Even though it's potentially less
fine-grained than using exec to call chmod, it's faster and safer to use the
Java methods if they're available.
27 files modified
336 ■■■■ changed files
opends/src/build-tools/org/opends/build/tools/GenerateMessageFile.java 1 ●●●● patch | view | raw | blame | history
opends/src/build-tools/org/opends/build/tools/MessagePropertyKey.java 2 ●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/statuspanel/StatusLog.java 2 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/QuickSetupLog.java 2 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java 2 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java 8 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java 6 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliServerGroup.java 6 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/DN2URI.java 85 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/ImportJob.java 53 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/NetworkGroup.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/NetworkGroupNamingContexts.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/RootDseWorkflowTopology.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/WorkflowTopologyNode.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/SaltedMD5PasswordStorageScheme.java 6 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/SaltedSHA1PasswordStorageScheme.java 8 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/SaltedSHA256PasswordStorageScheme.java 6 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/SaltedSHA384PasswordStorageScheme.java 6 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/SaltedSHA512PasswordStorageScheme.java 8 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/DN.java 33 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/Entry.java 9 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/FilePermission.java 17 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/StaticUtils.java 2 ●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/core/NetworkGroupTest.java 38 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowTopologyTest.java 14 ●●●● patch | view | raw | blame | history
opends/src/build-tools/org/opends/build/tools/GenerateMessageFile.java
@@ -56,7 +56,6 @@
import java.util.HashSet;
import java.util.Set;
import java.util.EnumSet;
import java.util.Hashtable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
opends/src/build-tools/org/opends/build/tools/MessagePropertyKey.java
@@ -213,7 +213,7 @@
   * @return name of message descriptor
   */
  public String getMessageDescriptorName() {
    return new StringBuffer()
    return new StringBuilder()
            .append(this.severity.messageDesciptorName())
            .append("_")
            .append(this.description).toString();
opends/src/guitools/org/opends/guitools/statuspanel/StatusLog.java
@@ -77,7 +77,7 @@
  }
  static private String getInitialLogRecord() {
    StringBuffer sb = new StringBuffer()
    StringBuilder sb = new StringBuilder()
            .append("Status application launched " +
                    DateFormat.getDateTimeInstance(DateFormat.LONG,
                                                   DateFormat.LONG).
opends/src/quicksetup/org/opends/quicksetup/QuickSetupLog.java
@@ -113,7 +113,7 @@
  static private String getInitialLogRecord() {
    // Note; currently the logs are not internationalized.
    StringBuffer sb = new StringBuffer()
    StringBuilder sb = new StringBuilder()
            .append("QuickSetup application launched " +
                    DateFormat.getDateTimeInstance(DateFormat.LONG,
                                                   DateFormat.LONG).
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -855,7 +855,7 @@
    String[] args = new String[argList.size()];
    argList.toArray(args);
    StringBuffer cmd = new StringBuffer();
    StringBuilder cmd = new StringBuilder();
    for (String s : argList)
    {
      if (cmd.length() > 0)
opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java
@@ -325,7 +325,7 @@
                Build build = parseBuildLine(line);
                builds.add(build);
              } catch (IllegalArgumentException iae) {
                StringBuffer msg = new StringBuffer()
                StringBuilder msg = new StringBuilder()
                        .append("Error parsing line '")
                        .append(line)
                        .append("': ")
@@ -367,7 +367,7 @@
      if (displayName == null ||
              downloadUrlString == null ||
              categoryString == null) {
        StringBuffer msg = new StringBuffer()
        StringBuilder msg = new StringBuilder()
                .append("Line '")
                .append(line)
                .append("' is incomplete or is not correctly delimited")
@@ -378,7 +378,7 @@
        try {
          downloadUrl = new URL(downloadUrlString);
        } catch (MalformedURLException e) {
          StringBuffer msg = new StringBuffer()
          StringBuilder msg = new StringBuilder()
                  .append("URL '")
                  .append(downloadUrlString)
                  .append("' is invalid");
@@ -386,7 +386,7 @@
        }
        category = Build.Category.fromString(categoryString);
        if (category == null) {
          StringBuffer msg = new StringBuffer()
          StringBuilder msg = new StringBuilder()
                  .append("Category '")
                  .append(categoryString)
                  .append("' is invalid; must be one of ");
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -517,7 +517,7 @@
  public static String getStringFromCollection(Collection<String> col,
      String separator)
  {
    StringBuffer msg = new StringBuffer();
    StringBuilder msg = new StringBuilder();
    for (String m : col)
    {
@@ -1139,7 +1139,7 @@
   */
  static public String listToString(List<?> list, String separator,
                                    String prefix, String suffix) {
    StringBuffer sb = new StringBuffer();
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < list.size(); i++) {
      if (prefix != null) {
        sb.append(prefix);
@@ -1163,7 +1163,7 @@
   * @return String representing the list
   */
  static public String stringArrayToString(String[] array, String separator) {
    StringBuffer sb = new StringBuffer();
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < array.length; i++) {
      sb.append(array[i]);
      if (i < array.length - 1) {
opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliServerGroup.java
@@ -549,7 +549,7 @@
        Set<Map<ServerGroupProperty, Object>> result = adsCtx
            .readServerGroupRegistry();
        StringBuffer buffer = new StringBuffer();
        StringBuilder buffer = new StringBuilder();
        // if not verbose mode, print group name (1 per line)
        if (! verboseArg.isPresent())
@@ -797,7 +797,7 @@
        {
          returnCode = SUCCESSFUL;
        }
        StringBuffer buffer = new StringBuffer();
        StringBuilder buffer = new StringBuilder();
        for (String member : memberList)
        {
          // We shouldn't print out the "cn="
@@ -831,7 +831,7 @@
            .readServerGroupRegistry();
        String MemberId = listMembershipMemberNameArg.getValue();
        StringBuffer buffer = new StringBuffer();
        StringBuilder buffer = new StringBuilder();
        for (Map<ServerGroupProperty, Object> groupProps : result)
        {
          // Get the group name;
opends/src/server/org/opends/server/backends/jeb/DN2URI.java
@@ -25,17 +25,20 @@
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package org.opends.server.backends.jeb;
import org.opends.messages.Message;
import com.sleepycat.je.*;
import org.opends.messages.Message;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.SearchOperation;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.protocols.asn1.ASN1OctetString;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.opends.server.types.AttributeValue;
import org.opends.server.types.ConditionResult;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
@@ -55,8 +58,6 @@
import static org.opends.server.util.ServerConstants.ATTR_REFERRAL_URL;
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.DebugLogLevel;
import static org.opends.messages.JebMessages.
     INFO_JEB_REFERRAL_RESULT_MESSAGE;
/**
@@ -84,10 +85,19 @@
   * The standard attribute type that is used to specify the set of referral
   * URLs in a referral entry.
   */
  public AttributeType referralType =
  private final AttributeType referralType =
       DirectoryServer.getAttributeType(ATTR_REFERRAL_URL);
  /**
   * A flag that indicates whether there are any referrals contained in this
   * database.  It should only be set to {@code false} when it is known that
   * there are no referrals.
   */
  private volatile ConditionResult containsReferrals =
       ConditionResult.UNDEFINED;
  /**
   * Create a new object representing a referral database in a given
   * entryContainer.
   *
@@ -155,6 +165,7 @@
    {
      return false;
    }
    containsReferrals = ConditionResult.TRUE;
    return true;
  }
@@ -180,6 +191,7 @@
    {
      return false;
    }
    containsReferrals = containsReferrals(txn);
    return true;
  }
@@ -220,10 +232,55 @@
    {
      return false;
    }
    containsReferrals = containsReferrals(txn);
    return true;
  }
  /**
   * Indicates whether the underlying database contains any referrals.
   *
   * @param  txn  The transaction to use when making the determination.
   *
   * @return  {@code true} if it is believed that the underlying database may
   *          contain at least one referral, or {@code false} if it is certain
   *          that it doesn't.
   */
  private ConditionResult containsReferrals(Transaction txn)
  {
    try
    {
      Cursor cursor = openCursor(txn, null);
      DatabaseEntry key  = new DatabaseEntry();
      DatabaseEntry data = new DatabaseEntry();
      OperationStatus status = cursor.getFirst(key, data, null);
      cursor.close();
      if (status == OperationStatus.SUCCESS)
      {
        return ConditionResult.TRUE;
      }
      else if (status == OperationStatus.NOTFOUND)
      {
        return ConditionResult.FALSE;
      }
      else
      {
        return ConditionResult.UNDEFINED;
      }
    }
    catch (Exception e)
    {
      if (debugEnabled())
      {
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
      }
      return ConditionResult.UNDEFINED;
    }
  }
  /**
   * Update the referral database for an entry that has been modified.  Does
   * not do anything unless the entry before the modification or the entry after
   * the modification is a referral entry.
@@ -478,6 +535,16 @@
  public void targetEntryReferrals(DN targetDN, SearchScope searchScope)
       throws DirectoryException
  {
    if (containsReferrals == ConditionResult.UNDEFINED)
    {
      containsReferrals = containsReferrals(null);
    }
    if (containsReferrals == ConditionResult.FALSE)
    {
      return;
    }
    Transaction txn = null;
    CursorConfig cursorConfig = null;
@@ -549,6 +616,16 @@
  public boolean returnSearchReferences(SearchOperation searchOp)
       throws DirectoryException
  {
    if (containsReferrals == ConditionResult.UNDEFINED)
    {
      containsReferrals = containsReferrals(null);
    }
    if (containsReferrals == ConditionResult.FALSE)
    {
      return true;
    }
    Transaction txn = null;
    CursorConfig cursorConfig = null;
opends/src/server/org/opends/server/backends/jeb/ImportJob.java
@@ -98,6 +98,17 @@
      new HashMap<DN, ImportContext>();
  /**
   * The maximum number of parent ID values that we will remember.
   */
  private static final int PARENT_ID_MAP_SIZE = 50;
  /**
   * Map of likely parent entry DNs to their entry IDs.
   */
  private HashMap<DN,EntryID> parentIDMap =
       new HashMap<DN,EntryID>(PARENT_ID_MAP_SIZE);
  /**
   * The number of entries imported.
   */
  private int importedCount;
@@ -867,7 +878,7 @@
            getParentWithinBase(entryDN);
        if (parentDN != null)
        {
          parentID = dn2id.get(txn, parentDN);
          parentID = getParentID(parentDN, dn2id, txn);
          if (parentID == null)
          {
            // Reject the entry.
@@ -952,6 +963,46 @@
  }
  /**
   * Retrieves the entry ID for the entry with the given DN.  This will use an
   * in-memory hash if possible, or will go to the database if it's not in
   * cache.  This should only be used for cacheable operations (like getting the
   * entry ID for the parent entry) where the same parent ID is likely to be
   * used multiple times.
   *
   * @param  parentDN  The DN of the parent entry for which to retrieve the
   *                   corresponding entry ID.
   * @param  dn2id     The handle to the dn2id database to use if the parent DN
   *                   isn't found in the local cache.
   * @param  txn       The transaction to use when interacting with the dn2id
   *                   database.
   *
   * @return  The entry ID for the entry with the given DN, or {@code null} if
   *          no such entry exists.
   */
  private EntryID getParentID(DN parentDN, DN2ID dn2id, Transaction txn)
          throws DatabaseException
  {
    EntryID parentID = parentIDMap.get(parentDN);
    if (parentID != null)
    {
      return parentID;
    }
    parentID = dn2id.get(txn, parentDN);
    if (parentID != null)
    {
      if (parentIDMap.size() >= PARENT_ID_MAP_SIZE)
      {
        parentIDMap.keySet().iterator().remove();
      }
      parentIDMap.put(parentDN, parentID);
    }
    return parentID;
  }
  /**
   * Get a statistic of the number of keys that reached the entry limit.
   * @return The number of keys that reached the entry limit.
   */
opends/src/server/org/opends/server/core/NetworkGroup.java
@@ -553,9 +553,9 @@
   * @param  leftMargin  white spaces used to indent traces
   * @return a string buffer that contains trace information
   */
  public StringBuffer toString(String leftMargin)
  public StringBuilder toString(String leftMargin)
  {
    StringBuffer sb = new StringBuffer();
    StringBuilder sb = new StringBuilder();
    String newMargin = leftMargin + "   ";
    sb.append (leftMargin + "Networkgroup (" + networkGroupID+ "\n");
opends/src/server/org/opends/server/core/NetworkGroupNamingContexts.java
@@ -128,9 +128,9 @@
   * @param  leftMargin  white spaces used to indent traces
   * @return a string buffer that contains trace information
   */
  public StringBuffer toString (String leftMargin)
  public StringBuilder toString (String leftMargin)
  {
    StringBuffer sb = new StringBuffer();
    StringBuilder sb = new StringBuilder();
    String newMargin = leftMargin + "   ";
    sb.append (leftMargin + "List of naming contexts:\n");
opends/src/server/org/opends/server/core/RootDseWorkflowTopology.java
@@ -162,9 +162,9 @@
   * @param leftMargin  white spaces used to indent the traces
   * @return a string buffer that contains trace information
   */
  public StringBuffer toString(String leftMargin)
  public StringBuilder toString(String leftMargin)
  {
    StringBuffer sb = new StringBuffer();
    StringBuilder sb = new StringBuilder();
    // display the baseDN
    sb.append(leftMargin + "Workflow baseDN:[ \"\" ]\n");
opends/src/server/org/opends/server/core/WorkflowTopologyNode.java
@@ -494,9 +494,9 @@
   * @param leftMargin  white spaces used to indent the traces
   * @return a string buffer that contains trace information
   */
  public StringBuffer toString(String leftMargin)
  public StringBuilder toString(String leftMargin)
  {
    StringBuffer sb = new StringBuffer();
    StringBuilder sb = new StringBuilder();
    // display the baseDN
    DN baseDN = getBaseDN();
opends/src/server/org/opends/server/extensions/SaltedMD5PasswordStorageScheme.java
@@ -29,8 +29,8 @@
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Random;
import java.util.concurrent.locks.ReentrantLock;
import org.opends.messages.Message;
@@ -97,7 +97,7 @@
  private ReentrantLock digestLock;
  // The secure random number generator to use to generate the salt values.
  private SecureRandom random;
  private Random random;
@@ -140,7 +140,7 @@
    digestLock = new ReentrantLock();
    random     = new SecureRandom();
    random     = new Random();
  }
opends/src/server/org/opends/server/extensions/SaltedSHA1PasswordStorageScheme.java
@@ -29,8 +29,8 @@
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Random;
import java.util.concurrent.locks.ReentrantLock;
import org.opends.messages.Message;
@@ -97,7 +97,7 @@
  private ReentrantLock digestLock;
  // The secure random number generator to use to generate the salt values.
  private SecureRandom random;
  private Random random;
@@ -138,7 +138,7 @@
    }
    digestLock = new ReentrantLock();
    random     = new SecureRandom();
    random     = new Random();
  }
@@ -536,7 +536,7 @@
         throws DirectoryException
  {
    byte[] saltBytes = new byte[NUM_SALT_BYTES];
    new SecureRandom().nextBytes(saltBytes);
    new Random().nextBytes(saltBytes);
    byte[] passwordPlusSalt = new byte[passwordBytes.length + NUM_SALT_BYTES];
    System.arraycopy(passwordBytes, 0, passwordPlusSalt, 0,
opends/src/server/org/opends/server/extensions/SaltedSHA256PasswordStorageScheme.java
@@ -29,8 +29,8 @@
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Random;
import java.util.concurrent.locks.ReentrantLock;
import org.opends.messages.Message;
@@ -98,7 +98,7 @@
  private ReentrantLock digestLock;
  // The secure random number generator to use to generate the salt values.
  private SecureRandom random;
  private Random random;
@@ -141,7 +141,7 @@
    digestLock = new ReentrantLock();
    random     = new SecureRandom();
    random     = new Random();
  }
opends/src/server/org/opends/server/extensions/SaltedSHA384PasswordStorageScheme.java
@@ -29,8 +29,8 @@
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Random;
import java.util.concurrent.locks.ReentrantLock;
import org.opends.messages.Message;
@@ -98,7 +98,7 @@
  private ReentrantLock digestLock;
  // The secure random number generator to use to generate the salt values.
  private SecureRandom random;
  private Random random;
@@ -141,7 +141,7 @@
    digestLock = new ReentrantLock();
    random     = new SecureRandom();
    random     = new Random();
  }
opends/src/server/org/opends/server/extensions/SaltedSHA512PasswordStorageScheme.java
@@ -29,8 +29,8 @@
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Random;
import java.util.concurrent.locks.ReentrantLock;
import org.opends.messages.Message;
@@ -98,7 +98,7 @@
  private ReentrantLock digestLock;
  // The secure random number generator to use to generate the salt values.
  private SecureRandom random;
  private Random random;
@@ -140,7 +140,7 @@
    }
    digestLock = new ReentrantLock();
    random     = new SecureRandom();
    random     = new Random();
  }
@@ -538,7 +538,7 @@
         throws DirectoryException
  {
    byte[] saltBytes = new byte[NUM_SALT_BYTES];
    new SecureRandom().nextBytes(saltBytes);
    new Random().nextBytes(saltBytes);
    byte[] passwordPlusSalt = new byte[passwordBytes.length + NUM_SALT_BYTES];
    System.arraycopy(passwordBytes, 0, passwordPlusSalt, 0,
opends/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java
@@ -138,7 +138,7 @@
  public static String formatStackTrace(Throwable t, int maxDepth,
                                        boolean includeCause)
  {
    StringBuffer buffer= new StringBuffer();
    StringBuilder buffer= new StringBuilder();
    while(t != null)
    {
@@ -191,7 +191,7 @@
  public static String formatStackTrace(StackTraceElement[] stackTrace,
                                        int maxDepth)
  {
    StringBuffer buffer= new StringBuffer();
    StringBuilder buffer= new StringBuilder();
    if (stackTrace != null) {
      int frameLimit=  Math.min(maxDepth, stackTrace.length);
opends/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java
@@ -921,7 +921,7 @@
  private String buildDefaultEntryMessage(Object[] args)
  {
    StringBuffer format = new StringBuffer();
    StringBuilder format = new StringBuilder();
    for (int i = 0; i < args.length; i++)
    {
      if (i != 0) format.append(", ");
opends/src/server/org/opends/server/types/DN.java
@@ -29,17 +29,17 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import org.opends.messages.Message;
import org.opends.server.core.DirectoryServer;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.protocols.asn1.ASN1OctetString;
import static org.opends.messages.SchemaMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
import static org.opends.messages.SchemaMessages.*;
import org.opends.messages.Message;
import static org.opends.server.util.StaticUtils.*;
@@ -148,7 +148,7 @@
   * @param  rdnComponents  The set of RDN components that make up
   *                        this DN.
   */
  public DN(ArrayList<RDN> rdnComponents)
  public DN(List<RDN> rdnComponents)
  {
    if ((rdnComponents == null) || rdnComponents.isEmpty())
    {
@@ -491,14 +491,14 @@
    // A null or empty DN is acceptable.
    if (dnString == null)
    {
      return new DN(new ArrayList<RDN>(0));
      return NULL_DN;
    }
    byte[] dnBytes = dnString.value();
    int    length  = dnBytes.length;
    if (length == 0)
    {
      return new DN(new ArrayList<RDN>(0));
      return NULL_DN;
    }
@@ -527,7 +527,7 @@
        // This means that the DN was completely comprised of spaces
        // and therefore should be considered the same as a null or
        // empty DN.
        return new DN(new ArrayList<RDN>(0));
        return NULL_DN;
      }
      else
      {
@@ -541,7 +541,7 @@
    // components.
    boolean allowExceptions =
         DirectoryServer.allowAttributeNameExceptions();
    ArrayList<RDN> rdnComponents = new ArrayList<RDN>();
    LinkedList<RDN> rdnComponents = new LinkedList<RDN>();
    while (true)
    {
      StringBuilder attributeName = new StringBuilder();
@@ -885,13 +885,13 @@
    // A null or empty DN is acceptable.
    if (dnString == null)
    {
      return new DN(new ArrayList<RDN>(0));
      return NULL_DN;
    }
    int length = dnString.length();
    if (length == 0)
    {
      return new DN(new ArrayList<RDN>(0));
      return NULL_DN;
    }
@@ -907,7 +907,7 @@
        // This means that the DN was completely comprised of spaces
        // and therefore should be considered the same as a null or
        // empty DN.
        return new DN(new ArrayList<RDN>(0));
        return NULL_DN;
      }
      else
      {
@@ -921,7 +921,7 @@
    // components.
    boolean allowExceptions =
         DirectoryServer.allowAttributeNameExceptions();
    ArrayList<RDN> rdnComponents = new ArrayList<RDN>();
    LinkedList<RDN> rdnComponents = new LinkedList<RDN>();
    while (true)
    {
      StringBuilder attributeName = new StringBuilder();
@@ -2675,6 +2675,11 @@
                                     StringBuilder hexChars)
          throws DirectoryException
  {
    if (hexChars.length() == 0)
    {
      return;
    }
    try
    {
      byte[] hexBytes = hexStringToByteArray(hexChars.toString());
opends/src/server/org/opends/server/types/Entry.java
@@ -5447,9 +5447,10 @@
    // Next, the set of objectclasses.
    final boolean typesOnly = exportConfig.typesOnly();
    if (exportConfig.includeObjectClasses())
    {
      if (exportConfig.typesOnly())
      if (typesOnly)
      {
        StringBuilder ocLine = new StringBuilder("objectClass:");
        writeLDIFLine(ocLine, writer, wrapLines, wrapColumn);
@@ -5490,7 +5491,7 @@
            continue;
          }
          if (exportConfig.typesOnly())
          if (typesOnly)
          {
            StringBuilder attrName = new StringBuilder(a.getName());
            for (String o : a.getOptions())
@@ -5552,7 +5553,7 @@
              continue;
            }
            if (exportConfig.typesOnly())
            if (typesOnly)
            {
              StringBuilder attrName = new StringBuilder(a.getName());
              for (String o : a.getOptions())
@@ -5620,7 +5621,7 @@
        {
          for (Attribute a : suppressedAttributes.get(t))
          {
            if (exportConfig.typesOnly())
            if (typesOnly)
            {
              StringBuilder attrName = new StringBuilder(a.getName());
              for (String o : a.getOptions())
opends/src/server/org/opends/server/types/FilePermission.java
@@ -539,6 +539,17 @@
    }
    // If we're running Java 6, then we'll use the methods that Java
    // provides.  Even though it's potentially less fine-grained on a
    // UNIX-based system, it is more efficient and doesn't require an
    // external process.
    if ((setReadableMethod != null) && (setWritableMethod != null) &&
        (setExecutableMethod != null))
    {
      return setUsingJava(f, p);
    }
    // If it's a UNIX-based system, then try using the chmod command
    // to set the permissions.  Otherwise (or if that fails), then try
    // to use the Java 6 API.
@@ -550,12 +561,6 @@
    // FIXME -- Consider using cacls on Windows.
    if ((setReadableMethod != null) && (setWritableMethod != null) &&
        (setExecutableMethod != null))
    {
      return setUsingJava(f, p);
    }
    // We have no way to set file permissions on this system.
    return false;
opends/src/server/org/opends/server/util/StaticUtils.java
@@ -3262,7 +3262,7 @@
   */
  static public String listToString(List<?> list, String separator)
  {
    StringBuffer sb = new StringBuffer();
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < list.size(); i++) {
      sb.append(list.get(i));
      if (i < list.size() - 1) {
opends/tests/unit-tests-testng/src/server/org/opends/server/core/NetworkGroupTest.java
@@ -121,7 +121,7 @@
  /**
   * Provides a single DN to search a workflow in a network group.
   *
   *
   * Each set of DNs is composed of:
   * - one baseDN
   * - one subordinateDN
@@ -273,10 +273,10 @@
  //
  //===========================================================================
  /**
   * Tests the network group registration.
   *
   *
   * @param networkGroupID   the ID of the network group to register
   * @param workflowBaseDN1  the base DN of the first workflow node to register
   *                         in the network group
@@ -291,7 +291,7 @@
    // Create and register the network group with the server.
    NetworkGroup networkGroup = new NetworkGroup(networkGroupID);
    networkGroup.register();
    // Register again the network group with the server and catch the
    // expected DirectoryServer exception.
    boolean exceptionRaised = false;
@@ -312,10 +312,10 @@
    WorkflowElement nullWE = null;
    WorkflowImpl workflow = new WorkflowImpl(
        workflowBaseDN.toString(), workflowBaseDN, nullWE);
    // Register the workflow with the network group.
    networkGroup.registerWorkflow(workflow);
    // Register again the workflow with the network group and catch the
    // expected DirectoryServer exception.
    exceptionRaised = false;
@@ -331,7 +331,7 @@
              ERR_REGISTER_WORKFLOW_NODE_ALREADY_EXISTS);
    }
    assertEquals(exceptionRaised, true);
    // Clean the network group
    networkGroup.deregisterWorkflow(workflow.getWorkflowId());
    networkGroup.deregister();
@@ -450,7 +450,7 @@
      doCheckNetworkGroup(networkGroup, dn2, subordinate2, unrelatedDN, true);
      doCheckNetworkGroup(networkGroup, dn3, subordinate3, unrelatedDN, true);
    }
    if (w2 != null)
    {
      networkGroup.deregisterWorkflow(w2.getWorkflowId());
@@ -458,7 +458,7 @@
      doCheckNetworkGroup(networkGroup, dn2, subordinate2, unrelatedDN, false);
      doCheckNetworkGroup(networkGroup, dn3, subordinate3, unrelatedDN, true);
    }
    if (w3 != null)
    {
      networkGroup.deregisterWorkflow(w3.getWorkflowId());
@@ -466,7 +466,7 @@
      doCheckNetworkGroup(networkGroup, dn2, subordinate2, unrelatedDN, false);
      doCheckNetworkGroup(networkGroup, dn3, subordinate3, unrelatedDN, false);
    }
    // Deregister the network group
    networkGroup.deregister();
  }
@@ -515,7 +515,7 @@
       Workflow workflow2 = networkGroup.getWorkflowCandidate(dnSubordinate);
       assertEquals(workflow2, workflow);
    }
    // Check that the unrelatedDN is not handled by any workflow
    if (unrelatedDN != null)
    {
@@ -561,8 +561,8 @@
    return workflow;
  }
  /**
   * Prints a text to System.out.
   */
@@ -570,8 +570,8 @@
  {
    System.out.print(msg);
  }
  /**
   * Prints a text to System.out.
   */
@@ -580,8 +580,8 @@
    write(msg + "\n");
  }
  /**
   * Dump the network group info to the console.
   */
@@ -591,8 +591,8 @@
    if (doDump)
    {
      StringBuffer sb = networkGroup.toString(prompt);
      writeln(sb.toString());
      StringBuilder sb = networkGroup.toString(prompt);
      writeln(sb.toString());
    }
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowTopologyTest.java
@@ -741,7 +741,7 @@
    assertEquals (readDN1, null);
    assertEquals (readDN2, null);
    assertEquals (readDN3, null);
    // ======================================================
    // Remove a workflow in the chain and check that
    // the route algorithm is still working
@@ -764,7 +764,7 @@
    assertEquals (readDN1, baseDN1);
    assertEquals (readDN2, baseDN1); // was baseDN2 before the removal...
    assertEquals (readDN3, baseDN3);
    // sanity check1
    // subordinate3 should be handled by w3 only
    readDN1 = w3.getParentBaseDN (subordinateDN1);
@@ -773,7 +773,7 @@
    assertEquals (readDN1, null);
    assertEquals (readDN2, null);
    assertEquals (readDN3, baseDN3);
    // sanity check2
    // unrelatedDN should be handled by none of the workflows
    readDN1 = w1.getParentBaseDN (unrelatedDN);
@@ -782,7 +782,7 @@
    assertEquals (readDN1, null);
    assertEquals (readDN2, null);
    assertEquals (readDN3, null);
  } // createWorkflow_simpleTopology2
@@ -914,7 +914,7 @@
    }
    // dump the topology
    StringBuffer sb = w1.toString ("");
    StringBuilder sb = w1.toString ("");
    System.out.println (sb);
  } // createWorkflow_complexTopology1
@@ -958,11 +958,11 @@
    // Create a workflow to handle the baseDN with no workflow element
    WorkflowImpl workflow = new WorkflowImpl(
        baseDN.toString(), baseDN, nullWE);
    // Register the workflow with the server. Don't catch the
    // DirectoryException that could be thrown by the register() method.
    workflow.register();
    // Register the same workflow twice and catch the expected
    // DirectoryException.
    boolean exceptionRaised = false;