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

Ludovic Poitou
20.12.2011 17e7241d4617adeae286b0954197cb88acf8798b
Code cleanup removing potential issues detected by FindBugs
3 files modified
30 ■■■■ changed files
opends/src/server/org/opends/server/replication/server/DraftCNDB.java 17 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationIterator.java 3 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/service/ReplicationBroker.java 10 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/DraftCNDB.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 */
package org.opends.server.replication.server;
import static org.opends.messages.ReplicationMessages.*;
@@ -273,17 +274,9 @@
    try
    {
      dbCloseLock.readLock().lock();
      cursor = db.openCursor(null, null);
    }
    catch (DatabaseException e1)
    {
      dbCloseLock.readLock().unlock();
      return 0;
    }
    try
    {
      try
      {
        cursor = db.openCursor(null, null);
        DatabaseEntry key = new DatabaseEntry();
        DatabaseEntry entry = new DatabaseEntry();
        OperationStatus status = cursor.getFirst(key, entry, LockMode.DEFAULT);
@@ -297,7 +290,8 @@
          str = new String(key.getData(), "UTF-8");
        } catch (UnsupportedEncodingException e)
        {
          // never happens
          // never happens, return anyway
          return 0;
        }
        int sn = new Integer(str);
        return sn;
@@ -373,7 +367,8 @@
          str = new String(key.getData(), "UTF-8");
        } catch (UnsupportedEncodingException e)
        {
          // never happens
          // never happens, returns anyway
          return 0;
        }
        int sn = new Integer(str);
        return sn;
opends/src/server/org/opends/server/replication/server/ReplicationIterator.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 */
package org.opends.server.replication.server;
@@ -128,9 +129,9 @@
        {
          cursor = db.openReadCursor(lastNonNullCurrentCN);
          currentChange = cursor.next(); // can return null
          lastNonNullCurrentCN = currentChange.getChangeNumber();
          if (currentChange != null)
          {
            lastNonNullCurrentCN = currentChange.getChangeNumber();
            hasNext = true;
          }
          else
opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 */
package org.opends.server.replication.service;
@@ -234,7 +235,7 @@
    this.groupId = groupId;
    this.generationID = generationId;
    this.heartbeatInterval = heartbeatInterval;
    this.maxRcvWindow = window;
    this.rcvWindow = window;
    this.maxRcvWindow = window;
    this.halfRcvWindow = window / 2;
    this.changeTimeHeartbeatSendInterval = changeTimeHeartbeatInterval;
@@ -2655,12 +2656,17 @@
              {
                // The best replication server is no more the one we are
                // currently using. Disconnect properly then reconnect.
                int bestServerId = -1;
                if (bestServerInfo != null)
                {
                  bestServerId = bestServerInfo.getServerId();
                }
                Message message =
                  NOTE_NEW_BEST_REPLICATION_SERVER.get(baseDn.toString(),
                  Integer.toString(serverId),
                  Integer.toString(rsServerId),
                  rsServerUrl,
                  Integer.toString(bestServerInfo.getServerId()));
                  Integer.toString(bestServerId));
                logError(message);
                reStart(true);
              }