From 15a0d1142e68d860e17f0b3dd130d5c44d4dd9f2 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Sat, 22 Sep 2012 12:21:06 +0000
Subject: [PATCH] Code cleanup after running Findbugs. Remove useless initializations, useless toString() on strings, and other redundant if tests...
---
opends/src/server/org/opends/server/replication/server/MessageHandler.java | 4
opends/src/server/org/opends/server/replication/server/ExternalChangeLogSessionImpl.java | 16 ---
opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java | 14 +-
opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java | 10 +-
opends/src/server/org/opends/server/replication/server/DbHandler.java | 4
opends/src/server/org/opends/server/replication/server/DataServerHandler.java | 18 ++--
opends/src/server/org/opends/server/replication/server/ReplicationServer.java | 20 ++--
opends/src/server/org/opends/server/replication/server/ECLServerWriter.java | 21 ++---
opends/src/server/org/opends/server/replication/server/ReplicationBackend.java | 6
opends/src/server/org/opends/server/replication/server/ServerHandler.java | 2
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java | 6
opends/src/server/org/opends/server/replication/service/ReplicationBroker.java | 20 ++--
opends/src/server/org/opends/server/replication/server/ReplicationDB.java | 15 +--
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java | 17 ++--
opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java | 4
opends/src/server/org/opends/server/replication/server/MonitorData.java | 37 ++++++--
16 files changed, 103 insertions(+), 111 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index 3df579b..5f2edbe 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -287,7 +287,7 @@
/**
* The attribute name used to store the generation id in the backend.
*/
- protected static final String REPLICATION_GENERATION_ID =
+ private static final String REPLICATION_GENERATION_ID =
"ds-sync-generation-id";
/**
* The attribute name used to store the fractional include configuration in
@@ -4164,7 +4164,7 @@
if (!backend.supportsLDIFImport())
{
Message message = ERR_INIT_IMPORT_NOT_SUPPORTED.get(
- backend.getBackendID().toString());
+ backend.getBackendID());
if (ieContext.getException() == null)
ieContext.setException(new DirectoryException(ResultCode.OTHER,
message));
@@ -4922,7 +4922,7 @@
if (!backend.supportsLDIFExport())
{
Message message = ERR_INIT_EXPORT_NOT_SUPPORTED.get(
- backend.getBackendID().toString());
+ backend.getBackendID());
logError(message);
throw new DirectoryException(ResultCode.OTHER, message);
}
diff --git a/opends/src/server/org/opends/server/replication/server/DataServerHandler.java b/opends/src/server/org/opends/server/replication/server/DataServerHandler.java
index 4848f37..9b41e5c 100644
--- a/opends/src/server/org/opends/server/replication/server/DataServerHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/DataServerHandler.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS
+ * Portions copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.replication.server;
@@ -109,7 +109,7 @@
public void changeStatusForResetGenId(long newGenId)
throws IOException
{
- StatusMachineEvent event = null;
+ StatusMachineEvent event;
if (newGenId == -1)
{
@@ -192,7 +192,7 @@
Message message = NOTE_BAD_GEN_ID_IN_FULL_UPDATE.get(
Integer.toString(replicationServerDomain.
getReplicationServer().getServerId()),
- getServiceId().toString(),
+ getServiceId(),
Integer.toString(serverId),
Long.toString(generationId),
Long.toString(newGenId));
@@ -242,7 +242,7 @@
ServerStatus newStatus = StatusMachine.computeNewStatus(status, event);
if (newStatus == ServerStatus.INVALID_STATUS)
{
- Message msg = ERR_RS_CANNOT_CHANGE_STATUS.get(getServiceId().toString(),
+ Message msg = ERR_RS_CANNOT_CHANGE_STATUS.get(getServiceId(),
Integer.toString(serverId), status.toString(), event.toString());
logError(msg);
// Status analyzer must only change from NORMAL_STATUS to DEGRADED_STATUS
@@ -384,7 +384,7 @@
if (event == StatusMachineEvent.INVALID_EVENT)
{
Message msg = ERR_RS_INVALID_NEW_STATUS.get(reqStatus.toString(),
- getServiceId().toString(), Integer.toString(serverId));
+ getServiceId(), Integer.toString(serverId));
logError(msg);
return ServerStatus.INVALID_STATUS;
}
@@ -499,10 +499,9 @@
return;
}
- StartMsg outStartMsg = null;
try
{
- outStartMsg = sendStartToRemote(protocolVersion);
+ StartMsg outStartMsg = sendStartToRemote(protocolVersion);
// log
logStartHandshakeRCVandSND(inServerStartMsg, outStartMsg);
@@ -694,8 +693,7 @@
DataFormatException,
NotSupportedOldVersionPDUException
{
- ReplicationMsg msg = null;
- msg = session.receive();
+ ReplicationMsg msg = session.receive();
if (msg instanceof StopMsg)
{
@@ -719,7 +717,7 @@
{
Message message = ERR_RS_INVALID_INIT_STATUS.get(
this.status.toString(),
- getServiceId().toString(),
+ getServiceId(),
Integer.toString(serverId));
throw new DirectoryException(ResultCode.OTHER, message);
}
diff --git a/opends/src/server/org/opends/server/replication/server/DbHandler.java b/opends/src/server/org/opends/server/replication/server/DbHandler.java
index 1ab48e1..5f478fd 100644
--- a/opends/src/server/org/opends/server/replication/server/DbHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/DbHandler.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS
+ * Portions copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.replication.server;
import org.opends.messages.MessageBuilder;
@@ -528,7 +528,7 @@
ArrayList<Attribute> attributes = new ArrayList<Attribute>();
attributes.add(Attributes.create("replicationServer-database",
String.valueOf(serverId)));
- attributes.add(Attributes.create("domain-name", baseDn.toString()));
+ attributes.add(Attributes.create("domain-name", baseDn));
if (firstChange != null)
{
Date firstTime = new Date(firstChange.getTime());
diff --git a/opends/src/server/org/opends/server/replication/server/ECLServerWriter.java b/opends/src/server/org/opends/server/replication/server/ECLServerWriter.java
index 447fc40..9f87191 100644
--- a/opends/src/server/org/opends/server/replication/server/ECLServerWriter.java
+++ b/opends/src/server/org/opends/server/replication/server/ECLServerWriter.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2009 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS
+ * Portions copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.replication.server;
import static org.opends.messages.ReplicationMessages.*;
@@ -234,19 +234,14 @@
return;
}
- // TODO:ECL please document the details of the cases where update could
- // be not null here
- if (update == null)
+ try
{
- try
- {
- handler.refreshEligibleCN();
- update = handler.takeECLUpdate();
- }
- catch(DirectoryException de)
- {
- TRACER.debugCaught(DebugLogLevel.ERROR, de);
- }
+ handler.refreshEligibleCN();
+ update = handler.takeECLUpdate();
+ }
+ catch(DirectoryException de)
+ {
+ TRACER.debugCaught(DebugLogLevel.ERROR, de);
}
if (update == null)
diff --git a/opends/src/server/org/opends/server/replication/server/ExternalChangeLogSessionImpl.java b/opends/src/server/org/opends/server/replication/server/ExternalChangeLogSessionImpl.java
index 34af3ab..7584a5d 100644
--- a/opends/src/server/org/opends/server/replication/server/ExternalChangeLogSessionImpl.java
+++ b/opends/src/server/org/opends/server/replication/server/ExternalChangeLogSessionImpl.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2009-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2012 ForgeRock AS
*/
package org.opends.server.replication.server;
@@ -33,7 +34,7 @@
import org.opends.server.types.DirectoryException;
/**
- * This interface defines a session used to search the external changelog
+ * This class implements a session used to search the external changelog
* in the Directory Server.
*/
public class ExternalChangeLogSessionImpl
@@ -41,18 +42,7 @@
{
ECLServerHandler handler;
- ReplicationServer rs;
- /**
- * Create a new external changelog session.
- * @param rs The replication server to which we will request the log.
- * @throws DirectoryException When an error occurs.
- */
- public ExternalChangeLogSessionImpl(ReplicationServer rs)
- throws DirectoryException
- {
- this.rs = rs;
- }
/**
* Create a new external changelog session.
@@ -66,8 +56,6 @@
StartECLSessionMsg startECLSessionMsg)
throws DirectoryException
{
- this.rs = rs;
-
this.handler = new ECLServerHandler(
rs.getServerURL(),
rs.getServerId(),
diff --git a/opends/src/server/org/opends/server/replication/server/MessageHandler.java b/opends/src/server/org/opends/server/replication/server/MessageHandler.java
index 3791a40..7a924c6 100644
--- a/opends/src/server/org/opends/server/replication/server/MessageHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/MessageHandler.java
@@ -681,8 +681,8 @@
if (!this.serviceId.equalsIgnoreCase(serviceId))
{
Message message = ERR_RS_DN_DOES_NOT_MATCH.get(
- this.serviceId.toString(),
- serviceId.toString());
+ this.serviceId,
+ serviceId);
throw new DirectoryException(ResultCode.OTHER,
message, null);
}
diff --git a/opends/src/server/org/opends/server/replication/server/MonitorData.java b/opends/src/server/org/opends/server/replication/server/MonitorData.java
index 1bee7d7..d894aec 100644
--- a/opends/src/server/org/opends/server/replication/server/MonitorData.java
+++ b/opends/src/server/org/opends/server/replication/server/MonitorData.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2009-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2012 ForgeRock AS
*/
package org.opends.server.replication.server;
@@ -179,9 +180,12 @@
int missingChangesLsiLsj =
ChangeNumber.diffSeqNum(lsjMaxCN, lsiLastCN);
- mds +=
- "+ diff("+lsjMaxCN+"-"
- +lsiLastCN+")="+missingChangesLsiLsj;
+ if (debugEnabled())
+ {
+ mds +=
+ "+ diff("+lsjMaxCN+"-"
+ +lsiLastCN+")="+missingChangesLsiLsj;
+ }
// Regarding a DS that is generating changes. If it is a local DS1,
// we get its server state, store it, then retrieve server states of
@@ -197,14 +201,20 @@
if (missingChangesLsiLsj <= 50)
{
missingChangesLsiLsj = 0;
- mds += " (diff replaced by 0 as for server id " + lsiSid + ")";
+ if (debugEnabled())
+ {
+ mds += " (diff replaced by 0 as for server id " + lsiSid + ")";
+ }
}
}
lsiMissingChanges += missingChangesLsiLsj;
}
}
- mds += "=" + lsiMissingChanges;
+ if (debugEnabled())
+ {
+ mds += "=" + lsiMissingChanges;
+ }
this.missingChanges.put(lsiSid,lsiMissingChanges);
}
@@ -227,19 +237,26 @@
int missingChangesLsiLsj =
ChangeNumber.diffSeqNum(lsjMaxCN, lsiLastCN);
- mds +=
- "+ diff("+lsjMaxCN+"-"
- +lsiLastCN+")="+missingChangesLsiLsj;
-
+ if (debugEnabled())
+ {
+ mds +=
+ "+ diff("+lsjMaxCN+"-"
+ +lsiLastCN+")="+missingChangesLsiLsj;
+ }
lsiMissingChanges += missingChangesLsiLsj;
}
}
- mds += "=" + lsiMissingChanges;
+ if (debugEnabled())
+ {
+ mds += "=" + lsiMissingChanges;
+ }
this.missingChangesRS.put(lsiSid,lsiMissingChanges);
if (debugEnabled())
+ {
TRACER.debugInfo(
"Complete monitor data : Missing changes ("+ lsiSid +")=" + mds);
+ }
}
}
diff --git a/opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java b/opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java
index c669651..1d4c14f 100644
--- a/opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java
+++ b/opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2009-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.replication.server;
@@ -92,7 +92,7 @@
if (debugEnabled())
{
TRACER.debugInfo("Monitoring publisher starting for dn "
- + replicationServerDomain.getBaseDn().toString());
+ + replicationServerDomain.getBaseDn());
}
try
@@ -136,7 +136,7 @@
catch (InterruptedException e)
{
TRACER.debugInfo("Monitoring publisher for dn "
- + replicationServerDomain.getBaseDn().toString()
+ + replicationServerDomain.getBaseDn()
+ " in RS "
+ replicationServerDomain.getReplicationServer()
.getServerId()
@@ -146,7 +146,7 @@
done = true;
TRACER.debugInfo("Monitoring publisher for dn "
- + replicationServerDomain.getBaseDn().toString()
+ + replicationServerDomain.getBaseDn()
+ " is terminated."
+ " This is in RS "
+ replicationServerDomain.getReplicationServer()
@@ -168,7 +168,7 @@
if (debugEnabled())
{
TRACER.debugInfo("Shutting down monitoring publisher for dn " +
- replicationServerDomain.getBaseDn().toString() + " in RS " +
+ replicationServerDomain.getBaseDn() + " in RS " +
replicationServerDomain.getReplicationServer().getServerId());
}
}
@@ -191,7 +191,7 @@
if (n >= FACTOR)
{
TRACER.debugInfo("Interrupting monitoring publisher for dn " +
- replicationServerDomain.getBaseDn().toString() + " in RS " +
+ replicationServerDomain.getBaseDn() + " in RS " +
replicationServerDomain.getReplicationServer().getServerId());
this.interrupt();
}
@@ -211,7 +211,7 @@
if (debugEnabled())
{
TRACER.debugInfo("Monitoring publisher for dn " +
- replicationServerDomain.getBaseDn().toString() +
+ replicationServerDomain.getBaseDn() +
" changing period value to " + period);
}
diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationBackend.java b/opends/src/server/org/opends/server/replication/server/ReplicationBackend.java
index d924f3a..c6ada99 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationBackend.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationBackend.java
@@ -536,7 +536,7 @@
ReplicationServerDomain rc = rsdi.next();
// Skip containers that are not covered by the include branches.
- baseDN = DN.decode(rc.getBaseDn().toString() + "," + BASE_DN);
+ baseDN = DN.decode(rc.getBaseDn() + "," + BASE_DN);
if (includeBranches == null || includeBranches.isEmpty())
{
@@ -792,7 +792,7 @@
UpdateMsg msg = ri.getChange();
processChange(
msg, exportConfig, ldifWriter, searchOperation,
- rsd.getBaseDn().toString());
+ rsd.getBaseDn());
if (!ri.next())
break;
}
@@ -1363,7 +1363,7 @@
ReplicationServerDomain rsd = rsdi.next();
// Skip containers that are not covered by the include branches.
- baseDN = DN.decode(rsd.getBaseDn().toString() + "," + BASE_DN);
+ baseDN = DN.decode(rsd.getBaseDn() + "," + BASE_DN);
if (searchBaseDN.isDescendantOf(baseDN) ||
searchBaseDN.isAncestorOf(baseDN))
diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationDB.java b/opends/src/server/org/opends/server/replication/server/ReplicationDB.java
index 9487ede..fe5b442 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationDB.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationDB.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.replication.server;
import org.opends.messages.MessageBuilder;
@@ -125,7 +125,7 @@
dbCloseLock = new ReentrantReadWriteLock(true);
//
- Cursor cursor = null;
+ Cursor cursor;
Transaction txn = null;
DatabaseEntry key = new DatabaseEntry();
DatabaseEntry data = new DatabaseEntry();
@@ -315,7 +315,6 @@
public ChangeNumber readFirstChange()
{
Cursor cursor = null;
- String str = null;
ChangeNumber cn = null;
try
@@ -343,7 +342,7 @@
return null;
}
- str = decodeUTF8(key.getData());
+ String str = decodeUTF8(key.getData());
cn = new ChangeNumber(str);
if (ReplicationDB.isaCounter(cn))
{
@@ -557,7 +556,7 @@
@Override
public String toString()
{
- return serverId + baseDn.toString();
+ return serverId + baseDn;
}
/**
@@ -633,9 +632,9 @@
{
// We can move close to the startingChangeNumber.
// Let's create a cursor from that point.
- DatabaseEntry key = new DatabaseEntry();
- DatabaseEntry data = new DatabaseEntry();
- if (localCursor.getPrev(key, data, LockMode.DEFAULT) !=
+ DatabaseEntry aKey = new DatabaseEntry();
+ DatabaseEntry aData = new DatabaseEntry();
+ if (localCursor.getPrev(aKey, aData, LockMode.DEFAULT) !=
OperationStatus.SUCCESS)
{
localCursor.close();
diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java b/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java
index 7c28c16..ecd0b73 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.replication.server;
import org.opends.messages.*;
@@ -167,7 +167,7 @@
String[] str = stringData.split(FIELD_SEPARATOR, 3);
if (str[0].equals(GENERATION_ID_TAG))
{
- long generationId=-1;
+ long generationId;
String baseDn;
diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
index ea5ee1e..614efdd 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.replication.server;
@@ -403,12 +403,12 @@
* check that all replication server in the config are in the
* connected Set. If not create the connection
*/
- for (String serverURL : replicationServers)
+ for (String aServerURL : replicationServers)
{
- final int separator = serverURL.lastIndexOf(':');
- final String portString = serverURL.substring(separator + 1);
+ final int separator = aServerURL.lastIndexOf(':');
+ final String portString = aServerURL.substring(separator + 1);
final int port = Integer.parseInt(portString);
- final String hostname = serverURL.substring(0, separator);
+ final String hostname = aServerURL.substring(0, separator);
final InetAddress inetAddress;
try
{
@@ -433,13 +433,13 @@
}
// Don't connect to a server if it is already connected.
- final String normalizedServerURL = normalizeServerURL(serverURL);
+ final String normalizedServerURL = normalizeServerURL(aServerURL);
if (connectedReplServers.contains(normalizedServerURL))
{
continue;
}
- connect(serverURL, domain.getBaseDn());
+ connect(aServerURL, domain.getBaseDn());
}
}
@@ -1697,9 +1697,7 @@
" getEligibleCN() ends with " +
" the following domainEligibleCN for each domain :" + debugLog +
" thus CrossDomainEligibleCN=" + eligibleCN +
- " ts=" +
- (eligibleCN!=null?
- new Date(eligibleCN.getTime()).toString(): null));
+ " ts=" + new Date(eligibleCN.getTime()).toString());
return eligibleCN;
}
@@ -1874,7 +1872,7 @@
// for this domain, have the state in the replchangelog
// where the last DraftCN update is
- long ec =0;
+ long ec;
if (domainsServerStateForLastSeqnum == null)
{
// Count changes of this domain from the beginning of the changelog
diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java b/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
index e4ddeb3..6a36e49 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS
+ * Portions copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.replication.server;
@@ -291,7 +291,7 @@
// look for the dbHandler that is responsible for the LDAP server which
// generated the change.
- DbHandler dbHandler = null;
+ DbHandler dbHandler;
synchronized (sourceDbHandlers)
{
dbHandler = sourceDbHandlers.get(id);
@@ -1936,7 +1936,7 @@
if (i==2)
{
Message message = ERR_EXCEPTION_SENDING_TOPO_INFO.get(
- baseDn.toString(),
+ baseDn,
"directory",
Integer.toString(handler.getServerId()),
e.getMessage());
@@ -1976,7 +1976,7 @@
if (i==2)
{
Message message = ERR_EXCEPTION_SENDING_TOPO_INFO.get(
- baseDn.toString(),
+ baseDn,
"replication",
Integer.toString(handler.getServerId()),
e.getMessage());
@@ -2186,7 +2186,7 @@
}
} catch (IOException e)
{
- logError(ERR_EXCEPTION_FORWARDING_RESET_GEN_ID.get(baseDn.toString(),
+ logError(ERR_EXCEPTION_FORWARDING_RESET_GEN_ID.get(baseDn,
e.getMessage()));
}
}
@@ -2200,8 +2200,7 @@
dsHandler.changeStatusForResetGenId(newGenId);
} catch (IOException e)
{
- logError(ERR_EXCEPTION_CHANGING_STATUS_AFTER_RESET_GEN_ID.get(baseDn.
- toString(),
+ logError(ERR_EXCEPTION_CHANGING_STATUS_AFTER_RESET_GEN_ID.get(baseDn,
Integer.toString(dsHandler.getServerId()),
e.getMessage()));
}
@@ -2343,7 +2342,7 @@
catch (IOException e)
{
logError(ERR_EXCEPTION_CHANGING_STATUS_FROM_STATUS_ANALYZER
- .get(baseDn.toString(),
+ .get(baseDn,
Integer.toString(serverHandler.getServerId()),
e.getMessage()));
}
@@ -3095,7 +3094,7 @@
// Publish to monitor the generation ID by replicationServerDomain
builder = new AttributeBuilder("generation-id");
- builder.add(baseDn.toString() + " " + generationId);
+ builder.add(baseDn + " " + generationId);
attributes.add(builder.toAttribute());
MonitorData md = getDomainMonitorData();
diff --git a/opends/src/server/org/opends/server/replication/server/ServerHandler.java b/opends/src/server/org/opends/server/replication/server/ServerHandler.java
index 0b58e05..20d7bd3 100644
--- a/opends/src/server/org/opends/server/replication/server/ServerHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/ServerHandler.java
@@ -574,7 +574,7 @@
ArrayList<Attribute> attributes = super.getMonitorData();
attributes.add(Attributes.create("server-id", String.valueOf(serverId)));
- attributes.add(Attributes.create("domain-name", getServiceId().toString()));
+ attributes.add(Attributes.create("domain-name", getServiceId()));
// Deprecated
attributes.add(Attributes.create("max-waiting-changes", String
diff --git a/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java b/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java
index e2e5b28..eed55f2 100644
--- a/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java
+++ b/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java
@@ -95,7 +95,7 @@
if (debugEnabled())
{
TRACER.debugInfo("Directory server status analyzer starting for dn " +
- replicationServerDomain.getBaseDn().toString());
+ replicationServerDomain.getBaseDn());
}
boolean interrupted = false;
@@ -211,7 +211,7 @@
if (debugEnabled())
{
TRACER.debugInfo("Shutting down status analyzer for dn "
- + replicationServerDomain.getBaseDn().toString() + " in RS "
+ + replicationServerDomain.getBaseDn() + " in RS "
+ replicationServerDomain.getReplicationServer().getServerId());
}
}
@@ -234,7 +234,7 @@
if (n >= FACTOR)
{
TRACER.debugInfo("Interrupting status analyzer for dn " +
- replicationServerDomain.getBaseDn().toString() + " in RS " +
+ replicationServerDomain.getBaseDn() + " in RS " +
replicationServerDomain.getReplicationServer().getServerId());
this.interrupt();
}
@@ -254,8 +254,8 @@
if (debugEnabled())
{
TRACER.debugInfo("Directory server status analyzer for dn " +
- replicationServerDomain.getBaseDn().toString() + " changing threshold" +
- " value to " + degradedStatusThreshold);
+ replicationServerDomain.getBaseDn() + " changing threshold value to " +
+ degradedStatusThreshold);
}
this.degradedStatusThreshold = degradedStatusThreshold;
diff --git a/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java b/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
index 927241a..1ac917a 100644
--- a/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
+++ b/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
@@ -396,7 +396,7 @@
// Get and compare addresses of RS1 and RS2
String rs1 = rs1Url.substring(0, separator1);
- InetAddress[] rs1Addresses = null;
+ InetAddress[] rs1Addresses;
try
{
if (isLocalAddress(rs1))
@@ -412,7 +412,7 @@
}
String rs2 = rs2Url.substring(0, separator2);
- InetAddress[] rs2Addresses = null;
+ InetAddress[] rs2Addresses;
try
{
if (isLocalAddress(rs1))
@@ -941,8 +941,7 @@
hasSomeServerWithSameGroupId(topologyMsg.getRsList());
// Really no other server with our group id ?
- if ((tmpRsGroupId == groupId) ||
- ((tmpRsGroupId != groupId) && !someServersWithSameGroupId))
+ if ((tmpRsGroupId == groupId) || (!someServersWithSameGroupId))
{
replicationServer = session.getReadableRemoteAddress();
maxSendWindow = replicationServerInfo.getWindowSize();
@@ -1001,7 +1000,7 @@
Byte.toString(groupId), Integer.toString(rsServerId),
replicationServerInfo.getServerURL(),
Byte.toString(getRsGroupId()),
- baseDn.toString(), Integer.toString(serverId));
+ baseDn, Integer.toString(serverId));
logError(message);
}
startRSHeartBeatMonitoring();
@@ -1263,7 +1262,7 @@
String repDn = replServerInfo.getBaseDn();
if (!(this.baseDn.equals(repDn)))
{
- errorMessage = ERR_DS_DN_DOES_NOT_MATCH.get(repDn.toString(),
+ errorMessage = ERR_DS_DN_DOES_NOT_MATCH.get(repDn,
this.baseDn);
return null;
}
@@ -1378,8 +1377,7 @@
try
{
// Send our Start Session
- StartECLSessionMsg startECLSessionMsg = null;
- startECLSessionMsg = new StartECLSessionMsg();
+ StartECLSessionMsg startECLSessionMsg = new StartECLSessionMsg();
startECLSessionMsg.setOperationId("-1");
session.publish(startECLSessionMsg);
@@ -1428,14 +1426,14 @@
private TopologyMsg performPhaseTwoHandshake(String server,
ServerStatus initStatus)
{
- TopologyMsg topologyMsg = null;
+ TopologyMsg topologyMsg;
try
{
/*
* Send our StartSessionMsg.
*/
- StartSessionMsg startSessionMsg = null;
+ StartSessionMsg startSessionMsg;
// May have created a broker with null replication domain for
// unit test purpose.
if (domain != null)
@@ -2828,7 +2826,7 @@
return false;
}
- private static final void debugInfo(String s)
+ private static void debugInfo(String s)
{
logError(Message.raw(Category.SYNC, Severity.NOTICE, s));
TRACER.debugInfo(s);
--
Gitblit v1.10.0