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

Ludovic Poitou
21.44.2011 76b96928a3b704a542482c63b93927ff449b1b5f
Code cleanup removing potential issues detected by FindBugs
3 files modified
102 ■■■■ changed files
opends/src/server/org/opends/server/util/args/ArgumentParser.java 10 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java 10 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java 82 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/args/ArgumentParser.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 */
package org.opends.server.util.args;
import org.opends.messages.Message;
@@ -577,7 +578,7 @@
  /**
   * Adds the provided argument to the set of arguments handled by this parser
   * and puts the arguement in the general group.
   * and puts the argument in the general group.
   *
   * @param  argument  The argument to be added.
   *
@@ -613,9 +614,9 @@
      throw new ArgumentException(message);
    }
    if (versionArgument != null)
    if ((versionArgument != null) && (shortID != null))
    {
      if (shortID == versionArgument.getShortIdentifier())
      if (shortID.equals(versionArgument.getShortIdentifier()))
      {
        // Update the version argument to not display its short identifier.
        try {
@@ -1401,7 +1402,8 @@
    {
      if (trailingArgsDisplayName == null)
      {
        buffer.append(" "+INFO_ARGPARSER_USAGE_TRAILINGARGS.get());
        buffer.append(" ");
        buffer.append(INFO_ARGPARSER_USAGE_TRAILINGARGS.get());
      }
      else
      {
opends/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 */
package org.opends.server.util.cli;
@@ -1150,7 +1151,14 @@
      copySecureArgsList.keyStorePathArg.addValue(keystorePath);
      commandBuilder.addArgument(copySecureArgsList.keyStorePathArg);
    }
    else
    {
      // KeystorePath is null. Either it's unspecified or there's a pb
      // We should throw an exception here, anyway since code below will
      // anyway
      throw ArgumentExceptionFactory
          .incompatiblePropertyModification("null keystorePath");
    }
    // Then the keystore password.
    keystorePassword = secureArgsList.keyStorePasswordArg.getValue();
opends/src/server/org/opends/server/workflowelement/externalchangelog/ECLSearchOperation.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2010 ForgeRock AS
 *      Portions Copyright 2010-2011 ForgeRock AS
 */
package org.opends.server.workflowelement.externalchangelog;
@@ -608,55 +608,51 @@
    // Start a specific ECL session
    eclSession = replicationServer.createECLSession(startECLSessionMsg);
    if (true)
    {
      // Loop on result entries
      int INITIAL=0;
      int PSEARCH=1;
      int phase=INITIAL;
      boolean returnedRoot = false;
      while (true)
      {
        // Check for a request to cancel this operation.
        checkIfCanceled(false);
    // Loop on result entries
    int phase = 0; // 0 is initial phase, 1 is psearch
    boolean returnedRoot = false;
        ECLUpdateMsg update = eclSession.getNextUpdate();
        if (update!=null)
    while (true)
    {
      // Check for a request to cancel this operation.
      checkIfCanceled(false);
      ECLUpdateMsg update = eclSession.getNextUpdate();
      if (update!=null)
      {
        if (!returnedRoot)
        {
          if (!returnedRoot)
          returnRootEntryIfRequired(true);
          returnedRoot = true;
        }
        if (phase == 0)
        {
          if (!buildAndReturnEntry(update))
          {
            returnRootEntryIfRequired(true);
            returnedRoot = true;
          }
          if (phase==INITIAL)
          {
            if (!buildAndReturnEntry(update))
            {
              // Abandon, Size limit reached
              eclSession.close();
              break;
            }
            // Abandon, Size limit reached
            eclSession.close();
            break;
          }
        }
        else
      }
      else
      {
        if (!returnedRoot)
        {
          if (!returnedRoot)
          returnRootEntryIfRequired(false);
          returnedRoot = true;
        }
        if (phase == 0)
        {
          if (this.persistentSearch == null)
          {
            returnRootEntryIfRequired(false);
            returnedRoot = true;
            eclSession.close();
            break;
          }
          if (phase==INITIAL)
          else
          {
            if (this.persistentSearch == null)
            {
              eclSession.close();
              break;
            }
            else
            {
              phase=PSEARCH;
              break;
            }
            phase = 1;
            break;
          }
        }
      }
@@ -1535,6 +1531,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public CancelResult cancel(CancelRequest cancelRequest)
  {
    if (debugEnabled())
@@ -1553,6 +1550,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public void abort(CancelRequest cancelRequest)
  {
    if (debugEnabled())
@@ -1580,7 +1578,7 @@
  {
    //  the conversion from one unique identifier to an other is
    //  a question of formating : the last "-" is placed
    StringBuffer buffer = new StringBuffer(entryUid);
    StringBuilder buffer = new StringBuilder(entryUid);
    //  Delete a "-" at 13 to get something like
    buffer.deleteCharAt(13);