From 55b437508acb80b4931a5d7f37b987adf367fa46 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Thu, 05 Jan 2012 17:37:33 +0000
Subject: [PATCH] Spring cleaning ! Fix minor issues and optimizations suggested by FindBugs and NetBeans.
---
opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java | 15 +
opends/src/server/org/opends/server/extensions/SASLContext.java | 6
opends/src/guitools/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java | 5
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java | 35 +++
opends/src/server/org/opends/server/core/SubentryPasswordPolicy.java | 72 ++++++--
opends/src/server/org/opends/server/plugins/ReferentialIntegrityPlugin.java | 28 ++-
opends/src/server/org/opends/server/replication/service/ReplicationDomain.java | 6
opends/src/server/org/opends/server/plugins/profiler/ProfileViewer.java | 9
opends/src/server/org/opends/server/tools/ManageTasks.java | 25 ++
opends/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java | 3
opends/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java | 59 +++----
opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java | 3
opends/src/server/org/opends/server/tools/tasks/TaskTool.java | 11 +
opends/src/server/org/opends/server/extensions/ConfigFileHandler.java | 4
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java | 161 +++++++++-----------
opends/src/server/org/opends/server/extensions/SASLByteChannel.java | 16 +
opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java | 4
17 files changed, 274 insertions(+), 188 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java
index d5d9a42..c4caee5 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2009-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2012 ForgeRock AS
*/
package org.opends.guitools.controlpanel.ui;
@@ -203,7 +204,7 @@
name = Utilities.createTextField("", 30);
gbc.weightx = 1.0;
gbc.gridwidth = 2;
- gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
gbc.insets.left = 10;
gbc.gridx = 1;
add(name, gbc);
@@ -222,7 +223,7 @@
parentDN = Utilities.createTextField("", 30);
gbc.weightx = 1.0;
- gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
gbc.insets.left = 10;
gbc.gridx = 1;
add(parentDN, gbc);
diff --git a/opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java b/opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
index fe3ff4c..cbe9473 100644
--- a/opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
+++ b/opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.backends.jeb.importLDIF;
@@ -773,7 +773,8 @@
}
}
- if(includeBranches.size() == 1 && excludeBranches.size() == 0 &&
+ if((includeBranches.size() == 1) &&
+ excludeBranches.isEmpty() &&
includeBranches.get(0).equals(baseDN))
{
// This entire base DN is explicitly included in the import with
@@ -1253,6 +1254,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Void call() throws Exception
{
for(Suffix suffix : dnSuffixMap.values()) {
@@ -1329,6 +1331,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Void call() throws Exception
{
for(Suffix suffix : dnSuffixMap.values()) {
@@ -1434,6 +1437,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Void call() throws Exception
{
try
@@ -1582,6 +1586,7 @@
}
+ @Override
void processAttribute(Index index, Entry entry, EntryID entryID,
IndexKey indexKey) throws DatabaseException,
InterruptedException
@@ -1622,6 +1627,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Void call() throws Exception
{
try
@@ -2141,6 +2147,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Void call() throws Exception
{
Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler());
@@ -2339,7 +2346,7 @@
*/
class DNState
{
- private final int DN_STATE_CACHE_SIZE = 64 * KB;
+ private static final int DN_STATE_CACHE_SIZE = 64 * KB;
private ByteBuffer parentDN, lastDN;
private EntryID parentID, lastID, entryID;
@@ -2667,6 +2674,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Void call() throws IOException
{
long offset = 0;
@@ -2966,6 +2974,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Void call() throws Exception
{
if (importConfiguration != null && importConfiguration.isCancelled()
@@ -3166,6 +3175,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int compareTo(IndexManager mgr)
{
return numberOfBuffers - mgr.numberOfBuffers;
@@ -3312,6 +3322,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Void call() throws Exception
{
ID2Entry id2entry = entryContainer.getID2Entry();
@@ -4109,10 +4120,12 @@
return this.totalEntries;
}
+ @Override
public void diskLowThresholdReached(DiskSpaceMonitor monitor) {
diskFullThresholdReached(monitor);
}
+ @Override
public void diskFullThresholdReached(DiskSpaceMonitor monitor) {
isCanceled = true;
Message msg = ERR_REBUILD_INDEX_LACK_DISK.get(
@@ -4121,6 +4134,7 @@
logError(msg);
}
+ @Override
public void diskSpaceRestored(DiskSpaceMonitor monitor) {
// Do nothing
}
@@ -4163,6 +4177,7 @@
/**
* The action to be performed by this timer task.
*/
+ @Override
public void run()
{
long latestTime = System.currentTimeMillis();
@@ -4644,6 +4659,7 @@
* @return {@code true} if the objects are equal, or {@code false} if they
* are not.
*/
+ @Override
public boolean equals(Object obj)
{
if (obj instanceof IndexKey) {
@@ -4664,6 +4680,7 @@
* @return The combined hash values of attribute type hash code and the
* index type hash code.
*/
+ @Override
public int hashCode()
{
return attributeType.hashCode() + indexType.hashCode();
@@ -4867,13 +4884,12 @@
private void addDN(DatabaseEntry val, Cursor cursor,
byte[] dnBytes) throws JebException
{
- int pos = 0;
byte[] bytes = val.getData();
int pLen = PackedInteger.getWriteIntLength(dnBytes.length);
int totLen = bytes.length + (pLen + dnBytes.length);
byte[] newRec = new byte[totLen];
System.arraycopy(bytes, 0, newRec, 0, bytes.length);
- pos = bytes.length;
+ int pos = bytes.length;
pos = PackedInteger.writeInt(newRec, pos, dnBytes.length);
System.arraycopy(dnBytes, 0, newRec, pos, dnBytes.length);
DatabaseEntry newVal = new DatabaseEntry(newRec);
@@ -4890,12 +4906,12 @@
//collisions.
private boolean isDNMatched(DatabaseEntry dns, byte[] dnBytes)
{
- int pos = 0, len = 0;
+ int pos = 0;
byte[] bytes = dns.getData();
while(pos < dns.getData().length)
{
int pLen = PackedInteger.getReadIntLength(bytes, pos);
- len = PackedInteger.readInt(bytes, pos);
+ int len = PackedInteger.readInt(bytes, pos);
if(indexComparator.compare(bytes, pos + pLen, len, dnBytes,
dnBytes.length) == 0)
{
@@ -4913,6 +4929,7 @@
* @return {@code true} if the specified DN is in the temporary DN cache,
* or {@code false} if it is not.
*/
+ @Override
public boolean contains(DN dn)
{
boolean dnExists = false;
@@ -4966,6 +4983,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void uncaughtException(Thread t, Throwable e) {
if (debugEnabled())
{
@@ -4982,6 +5000,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void diskLowThresholdReached(DiskSpaceMonitor monitor) {
diskFullThresholdReached(monitor);
}
@@ -4989,6 +5008,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void diskFullThresholdReached(DiskSpaceMonitor monitor) {
isCanceled = true;
Message msg;
@@ -5010,6 +5030,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void diskSpaceRestored(DiskSpaceMonitor monitor) {
// Do nothing.
}
diff --git a/opends/src/server/org/opends/server/core/SubentryPasswordPolicy.java b/opends/src/server/org/opends/server/core/SubentryPasswordPolicy.java
index b87335c..bc3275d 100644
--- a/opends/src/server/org/opends/server/core/SubentryPasswordPolicy.java
+++ b/opends/src/server/org/opends/server/core/SubentryPasswordPolicy.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2010 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS.
+ * Portions copyright 2011-2012 ForgeRock AS.
*/
package org.opends.server.core;
@@ -65,22 +65,23 @@
private static final DebugTracer TRACER = getTracer();
// Password Policy Subentry draft attributes.
- private final String PWD_OC_POLICY = "pwdpolicy";
- private final String PWD_ATTR_ATTRIBUTE = "pwdattribute";
- private final String PWD_ATTR_MINAGE = "pwdminage";
- private final String PWD_ATTR_MAXAGE = "pwdmaxage";
- private final String PWD_ATTR_INHISTORY = "pwdinhistory";
- private final String PWD_ATTR_CHECKQUALITY = "pwdcheckquality";
- private final String PWD_ATTR_MINLENGTH = "pwdminlength";
- private final String PWD_ATTR_EXPIREWARNING = "pwdexpirewarning";
- private final String PWD_ATTR_GRACEAUTHNLIMIT = "pwdgraceauthnlimit";
- private final String PWD_ATTR_LOCKOUT = "pwdlockout";
- private final String PWD_ATTR_LOCKOUTDURATION = "pwdlockoutduration";
- private final String PWD_ATTR_MAXFAILURE = "pwdmaxfailure";
- private final String PWD_ATTR_MUSTCHANGE = "pwdmustchange";
- private final String PWD_ATTR_ALLOWUSERCHANGE = "pwdallowuserchange";
- private final String PWD_ATTR_SAFEMODIFY = "pwdsafemodify";
- private final String PWD_ATTR_FAILURECOUNTINTERVAL ="pwdfailurecountinterval";
+ private static final String PWD_OC_POLICY = "pwdpolicy";
+ private static final String PWD_ATTR_ATTRIBUTE = "pwdattribute";
+ private static final String PWD_ATTR_MINAGE = "pwdminage";
+ private static final String PWD_ATTR_MAXAGE = "pwdmaxage";
+ private static final String PWD_ATTR_INHISTORY = "pwdinhistory";
+ private static final String PWD_ATTR_CHECKQUALITY = "pwdcheckquality";
+ private static final String PWD_ATTR_MINLENGTH = "pwdminlength";
+ private static final String PWD_ATTR_EXPIREWARNING = "pwdexpirewarning";
+ private static final String PWD_ATTR_GRACEAUTHNLIMIT = "pwdgraceauthnlimit";
+ private static final String PWD_ATTR_LOCKOUT = "pwdlockout";
+ private static final String PWD_ATTR_LOCKOUTDURATION = "pwdlockoutduration";
+ private static final String PWD_ATTR_MAXFAILURE = "pwdmaxfailure";
+ private static final String PWD_ATTR_MUSTCHANGE = "pwdmustchange";
+ private static final String PWD_ATTR_ALLOWUSERCHANGE = "pwdallowuserchange";
+ private static final String PWD_ATTR_SAFEMODIFY = "pwdsafemodify";
+ private static final String PWD_ATTR_FAILURECOUNTINTERVAL =
+ "pwdfailurecountinterval";
// Password Policy Subentry DN.
private final DN passwordPolicySubentryDN;
@@ -569,6 +570,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isAllowExpiredPasswordChanges()
{
return getDefaultPasswordPolicy().isAllowExpiredPasswordChanges();
@@ -579,6 +581,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isAllowMultiplePasswordValues()
{
return getDefaultPasswordPolicy().isAllowMultiplePasswordValues();
@@ -589,6 +592,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isAllowPreEncodedPasswords()
{
return getDefaultPasswordPolicy().isAllowPreEncodedPasswords();
@@ -599,6 +603,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isAllowUserPasswordChanges()
{
return pAllowUserPasswordChanges != null ? pAllowUserPasswordChanges
@@ -610,6 +615,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isExpirePasswordsWithoutWarning()
{
return getDefaultPasswordPolicy().isExpirePasswordsWithoutWarning();
@@ -620,6 +626,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isForceChangeOnAdd()
{
// Don't use pwdMustChange since the password provided when the entry was
@@ -632,6 +639,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isForceChangeOnReset()
{
return pForceChangeOnReset != null ? pForceChangeOnReset
@@ -643,6 +651,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getGraceLoginCount()
{
return pGraceLoginCount != null ? pGraceLoginCount
@@ -654,6 +663,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public long getIdleLockoutInterval()
{
return getDefaultPasswordPolicy().getIdleLockoutInterval();
@@ -664,6 +674,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public AttributeType getLastLoginTimeAttribute()
{
return getDefaultPasswordPolicy().getLastLoginTimeAttribute();
@@ -674,6 +685,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public String getLastLoginTimeFormat()
{
return getDefaultPasswordPolicy().getLastLoginTimeFormat();
@@ -684,6 +696,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public long getLockoutDuration()
{
return pLockoutDuration != null ? pLockoutDuration
@@ -695,6 +708,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getLockoutFailureCount()
{
return pLockoutFailureCount != null ? pLockoutFailureCount
@@ -706,6 +720,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public long getLockoutFailureExpirationInterval()
{
return pLockoutFailureExpirationInterval != null ?
@@ -718,6 +733,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public long getMaxPasswordAge()
{
return pMaxPasswordAge != null ? pMaxPasswordAge
@@ -729,6 +745,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public long getMaxPasswordResetAge()
{
return getDefaultPasswordPolicy().getMaxPasswordResetAge();
@@ -739,6 +756,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public long getMinPasswordAge()
{
return pMinPasswordAge != null ? pMinPasswordAge
@@ -750,6 +768,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public AttributeType getPasswordAttribute()
{
return pPasswordAttribute != null ? pPasswordAttribute
@@ -761,6 +780,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isPasswordChangeRequiresCurrentPassword()
{
return pPasswordChangeRequiresCurrentPassword != null ?
@@ -773,6 +793,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public long getPasswordExpirationWarningInterval()
{
return pPasswordExpirationWarningInterval != null ?
@@ -785,6 +806,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getPasswordHistoryCount()
{
return pPasswordHistoryCount != null ? pPasswordHistoryCount
@@ -796,6 +818,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public long getPasswordHistoryDuration()
{
return getDefaultPasswordPolicy().getPasswordHistoryDuration();
@@ -806,6 +829,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public SortedSet<String> getPreviousLastLoginTimeFormats()
{
return getDefaultPasswordPolicy().getPreviousLastLoginTimeFormats();
@@ -816,6 +840,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public long getRequireChangeByTime()
{
return getDefaultPasswordPolicy().getRequireChangeByTime();
@@ -826,6 +851,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isRequireSecureAuthentication()
{
return getDefaultPasswordPolicy().isRequireSecureAuthentication();
@@ -836,6 +862,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isRequireSecurePasswordChanges()
{
return getDefaultPasswordPolicy().isRequireSecurePasswordChanges();
@@ -846,6 +873,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isSkipValidationForAdministrators()
{
return getDefaultPasswordPolicy().isSkipValidationForAdministrators();
@@ -856,6 +884,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public StateUpdateFailurePolicy getStateUpdateFailurePolicy()
{
return getDefaultPasswordPolicy().getStateUpdateFailurePolicy();
@@ -866,6 +895,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isAuthPasswordSyntax()
{
return pAuthPasswordSyntax != null ? pAuthPasswordSyntax
@@ -877,6 +907,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<PasswordStorageScheme<?>> getDefaultPasswordStorageSchemes()
{
return getDefaultPasswordPolicy().getDefaultPasswordStorageSchemes();
@@ -887,6 +918,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Set<String> getDeprecatedPasswordStorageSchemes()
{
return getDefaultPasswordPolicy().getDeprecatedPasswordStorageSchemes();
@@ -897,6 +929,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public DN getDN()
{
return passwordPolicySubentryDN;
@@ -907,6 +940,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isDefaultPasswordStorageScheme(String name)
{
return getDefaultPasswordPolicy().isDefaultPasswordStorageScheme(name);
@@ -917,6 +951,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isDeprecatedPasswordStorageScheme(String name)
{
return getDefaultPasswordPolicy().isDeprecatedPasswordStorageScheme(name);
@@ -927,6 +962,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Collection<PasswordValidator<?>> getPasswordValidators()
{
return getDefaultPasswordPolicy().getPasswordValidators();
@@ -937,6 +973,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Collection<AccountStatusNotificationHandler<?>>
getAccountStatusNotificationHandlers()
{
@@ -948,6 +985,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public PasswordGenerator<?> getPasswordGenerator()
{
return getDefaultPasswordPolicy().getPasswordGenerator();
diff --git a/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java b/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
index e348558..48d4403 100644
--- a/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
+++ b/opends/src/server/org/opends/server/extensions/ConfigFileHandler.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.extensions;
@@ -266,7 +266,7 @@
// configuration in the archive. If it doesn't, then archive it.
maintainConfigArchive = envConfig.maintainConfigArchive();
maxConfigArchiveSize = envConfig.getMaxConfigArchiveSize();
- if (maintainConfigArchive & (! useLastKnownGoodConfig))
+ if (maintainConfigArchive && (! useLastKnownGoodConfig))
{
try
{
diff --git a/opends/src/server/org/opends/server/extensions/SASLByteChannel.java b/opends/src/server/org/opends/server/extensions/SASLByteChannel.java
index 6159f49..f7749d8 100644
--- a/opends/src/server/org/opends/server/extensions/SASLByteChannel.java
+++ b/opends/src/server/org/opends/server/extensions/SASLByteChannel.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2012 ForgeRock AS
*/
package org.opends.server.extensions;
@@ -52,7 +53,7 @@
private RedirectingByteChannel channel;
// The number of bytes in the length buffer.
- private final int lengthSize = 4;
+ private static final int lengthSize = 4;
//Length of the buffer.
private int bufLength;
@@ -160,9 +161,8 @@
*/
private int readAll(ByteBuffer byteBuf, int total) throws IOException
{
- int count = 0;
while (channel.isOpen() && total > 0) {
- count = channel.read(byteBuf);
+ int count = channel.read(byteBuf);
if (count == -1) return -1;
if (count == 0) return 0;
total -= count;
@@ -197,6 +197,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public synchronized int read(ByteBuffer clearDst) throws IOException {
int bytesToRead = lengthSize;
if(reading)
@@ -275,6 +276,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public synchronized int write(ByteBuffer clearSrc) throws IOException {
int sendBufSize = getAppBufSize();
int srcLen = clearSrc.remaining();
@@ -314,6 +316,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public synchronized void close() throws IOException {
saslContext.dispose();
saslContext=null;
@@ -322,6 +325,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isOpen() {
return saslContext != null;
}
@@ -329,6 +333,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getAppBufSize() {
return saslContext.getBufSize(Sasl.MAX_BUFFER);
}
@@ -336,6 +341,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Certificate[] getClientCertificateChain() {
return new Certificate[0];
}
@@ -343,6 +349,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getSSF() {
return saslContext.getSSF();
}
@@ -350,6 +357,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public ByteChannel wrapChannel(ByteChannel channel) {
return this;
}
@@ -357,6 +365,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public String getName() {
return name;
}
@@ -364,6 +373,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isSecure() {
return true;
}
diff --git a/opends/src/server/org/opends/server/extensions/SASLContext.java b/opends/src/server/org/opends/server/extensions/SASLContext.java
index c94cc20..7d68665 100644
--- a/opends/src/server/org/opends/server/extensions/SASLContext.java
+++ b/opends/src/server/org/opends/server/extensions/SASLContext.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS.
+ * Portions copyright 2011-2012 ForgeRock AS.
*/
package org.opends.server.extensions;
@@ -111,8 +111,8 @@
private BindOperation bindOp;
//Used to check if negotiated QOP is confidentiality or integrity.
- private final String confidentiality = "auth-conf";
- private final String integrity = "auth-int";
+ private static final String confidentiality = "auth-conf";
+ private static final String integrity = "auth-int";
/**
diff --git a/opends/src/server/org/opends/server/plugins/ReferentialIntegrityPlugin.java b/opends/src/server/org/opends/server/plugins/ReferentialIntegrityPlugin.java
index 2784199..35a4545 100644
--- a/opends/src/server/org/opends/server/plugins/ReferentialIntegrityPlugin.java
+++ b/opends/src/server/org/opends/server/plugins/ReferentialIntegrityPlugin.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS.
+ * Portions copyright 2011-2012 ForgeRock AS.
* Portions copyright 2011 profiq s.r.o.
*/
package org.opends.server.plugins;
@@ -125,7 +125,8 @@
private boolean stopRequested=false;
//The thread name.
- private final String name="Referential Integrity Background Update Thread";
+ private static final String name =
+ "Referential Integrity Background Update Thread";
//The name of the logfile that the update thread uses to process change
//records. Defaults to "logs/referint", but can be changed in the
@@ -170,6 +171,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void initializePlugin(Set<PluginType> pluginTypes,
ReferentialIntegrityPluginCfg pluginCfg)
throws ConfigException
@@ -201,6 +203,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public ConfigChangeResult applyConfigurationChange(
ReferentialIntegrityPluginCfg newConfiguration)
{
@@ -322,8 +325,8 @@
// Iterate through all of the defined attribute types and ensure that they
// have acceptable syntaxes and that they are indexed for equality below all
// base DNs.
- Set<AttributeType> attributeTypes = pluginCfg.getAttributeType();
- for (AttributeType type : attributeTypes)
+ Set<AttributeType> theAttributeTypes = pluginCfg.getAttributeType();
+ for (AttributeType type : theAttributeTypes)
{
if (! isAttributeSyntaxValid(type))
{
@@ -368,7 +371,7 @@
AttributeType attrType =
DirectoryServer.getAttributeType(attr.toLowerCase());
- if (attrType == null || !attributeTypes.contains(attrType))
+ if (attrType == null || !theAttributeTypes.contains(attrType))
{
isAcceptable = false;
unacceptableReasons.add(
@@ -398,6 +401,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isConfigurationChangeAcceptable(
ReferentialIntegrityPluginCfg configuration,
List<Message> unacceptableReasons)
@@ -410,6 +414,7 @@
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
+ @Override
public PluginResult.PostOperation
doPostOperation(PostOperationModifyDNOperation
modifyDNOperation)
@@ -443,6 +448,7 @@
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
+ @Override
public PluginResult.PostOperation doPostOperation(
PostOperationDeleteOperation deleteOperation)
{
@@ -470,6 +476,7 @@
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
+ @Override
public PluginResult.SubordinateModifyDN processSubordinateModifyDN(
SubordinateModifyDNOperation modifyDNOperation, Entry oldEntry,
Entry newEntry, List<Modification> modifications)
@@ -493,6 +500,7 @@
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
+ @Override
public PluginResult.SubordinateDelete processSubordinateDelete(
DeleteOperation deleteOperation, Entry entry)
{
@@ -989,6 +997,7 @@
* @return The name of the listener.
*
*/
+ @Override
public String getShutdownListenerName() {
return name;
}
@@ -1013,6 +1022,7 @@
* @param reason The reason message for the shutdown.
*
*/
+ @Override
public void processServerShutdown(Message reason)
{
stopRequested = true;
@@ -1086,6 +1096,7 @@
/**
* Run method for the background thread.
*/
+ @Override
public void run() {
while(!isShuttingDown()) {
try {
@@ -1221,10 +1232,10 @@
private PluginResult.PreOperation
isIntegrityMaintained(List<Attribute> attrs, DN entryDN, DN entryBaseDN)
{
- PluginResult.PreOperation result = null;
for(Attribute attr : attrs)
{
- result = isIntegrityMaintained(attr, entryDN, entryBaseDN);
+ PluginResult.PreOperation result =
+ isIntegrityMaintained(attr, entryDN, entryBaseDN);
if (result != PluginResult.PreOperation.continueOperationProcessing())
{
return result;
@@ -1256,10 +1267,9 @@
while (attrValIt.hasNext())
{
AttributeValue attrVal = attrValIt.next();
- DN valueEntryDN = null;
Entry valueEntry = null;
- valueEntryDN = DN.decode(attrVal.getNormalizedValue());
+ DN valueEntryDN = DN.decode(attrVal.getNormalizedValue());
if (currentConfiguration.getCheckReferencesScopeCriteria()
== CheckReferencesScopeCriteria.NAMING_CONTEXT)
diff --git a/opends/src/server/org/opends/server/plugins/profiler/ProfileViewer.java b/opends/src/server/org/opends/server/plugins/profiler/ProfileViewer.java
index d100c4d..ed680c6 100644
--- a/opends/src/server/org/opends/server/plugins/profiler/ProfileViewer.java
+++ b/opends/src/server/org/opends/server/plugins/profiler/ProfileViewer.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2012 ForgeRock AS
*/
package org.opends.server.plugins.profiler;
import org.opends.messages.Message;
@@ -100,7 +101,7 @@
public static void main(String[] args)
{
// Define the command-line arguments that may be used with this program.
- BooleanArgument displayUsage = null;
+ BooleanArgument displayUsage;
BooleanArgument useGUI = null;
StringArgument fileNames = null;
@@ -418,8 +419,8 @@
"captured over " + totalDuration + " milliseconds";
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(label, true);
- ProfileStackFrame[] rootFrames = getRootFrames();
- if (rootFrames.length == 0)
+ ProfileStackFrame[] theRootFrames = getRootFrames();
+ if (theRootFrames.length == 0)
{
System.err.println("ERROR: No data available for viewing.");
return;
@@ -475,7 +476,6 @@
return;
}
- String largestCountString = String.valueOf(subFrames[0].getTotalCount());
for (ProfileStackFrame subFrame : subFrames)
{
@@ -524,6 +524,7 @@
* @param tse The tree selection event with information about the selection
* or deselection that occurred.
*/
+ @Override
public void valueChanged(TreeSelectionEvent tse)
{
try
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 5c5295f..ace05d4 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.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.plugin;
@@ -127,14 +127,14 @@
import org.opends.server.tasks.PurgeConflictsHistoricalTask;
/**
- * This class implements the bulk part of the.of the Directory Server side
+ * This class implements the bulk part of the Directory Server side
* of the replication code.
* It contains the root method for publishing a change,
* processing a change received from the replicationServer service,
* handle conflict resolution,
* handle protocol messages from the replicationServer.
*/
-public class LDAPReplicationDomain extends ReplicationDomain
+public final class LDAPReplicationDomain extends ReplicationDomain
implements ConfigurationChangeListener<ReplicationDomainCfg>,
AlertGenerator
{
@@ -158,6 +158,7 @@
this.endChangeNumber = endChangeNumber;
}
+ @Override
public void handleInternalSearchEntry(
InternalSearchOperation searchOperation, SearchResultEntry searchEntry)
throws DirectoryException
@@ -181,6 +182,7 @@
}
}
+ @Override
public void handleInternalSearchReference(
InternalSearchOperation searchOperation,
SearchResultReference searchReference) throws DirectoryException
@@ -214,7 +216,6 @@
private final AtomicInteger numResolvedModifyConflicts = new AtomicInteger();
private final AtomicInteger numUnresolvedNamingConflicts =
new AtomicInteger();
- private final int debugCount = 0;
private final PersistentServerState state;
private int numReplayedPostOpCalled = 0;
@@ -522,19 +523,18 @@
configuration.getServerId(),
configuration.getInitializationWindowSize());
- /**
- * The time in milliseconds between heartbeats from the replication
- * server. Zero means heartbeats are off.
- */
- long heartbeatInterval = 0;
-
// Read the configuration parameters.
Set<String> replicationServers = configuration.getReplicationServer();
this.serverId = configuration.getServerId();
this.baseDn = configuration.getBaseDN();
int window = configuration.getWindowSize();
- heartbeatInterval = configuration.getHeartbeatInterval();
+ /**
+ * The time in milliseconds between heartbeats from the replication
+ * server. Zero means heartbeats are off.
+ */
+ long heartbeatInterval = configuration.getHeartbeatInterval();
+
this.isolationPolicy = configuration.getIsolationPolicy();
this.configDn = configuration.dn();
this.logChangeNumber = configuration.isLogChangenumber();
@@ -733,7 +733,7 @@
boolean allowReconnection)
{
// Read the configuration entry
- FractionalConfig newFractionalConfig = null;
+ FractionalConfig newFractionalConfig;
try
{
newFractionalConfig = FractionalConfig.toFractionalConfig(
@@ -755,7 +755,7 @@
*/
// Compute current configuration
- boolean needReconnection = false;
+ boolean needReconnection;
try
{
needReconnection = !FractionalConfig.
@@ -772,8 +772,9 @@
// Disable service if configuration changed
if (needReconnection && allowReconnection)
+ {
disableService();
-
+ }
// Set new configuration
int newFractionalMode = newFractionalConfig.fractionalConfigToInt();
fractionalConfig.setFractional(newFractionalMode !=
@@ -836,12 +837,11 @@
* Search the domain root entry that is used to save the generation id
*/
- InternalSearchOperation search = null;
LinkedHashSet<String> attributes = new LinkedHashSet<String>(1);
attributes.add(REPLICATION_GENERATION_ID);
attributes.add(REPLICATION_FRACTIONAL_EXCLUDE);
attributes.add(REPLICATION_FRACTIONAL_INCLUDE);
- search = conn.processSearch(asn1BaseDn,
+ InternalSearchOperation search = conn.processSearch(asn1BaseDn,
SearchScope.BASE_OBJECT,
DereferencePolicy.DEREF_ALWAYS, 0, 0, false,
filter, attributes);
@@ -962,7 +962,7 @@
new HashMap<String, List<String>>();
List<String> storedFractionalAllClassesAttributes = new ArrayList<String>();
- int storedFractionalMode = FractionalConfig.NOT_FRACTIONAL;
+ int storedFractionalMode;
try
{
storedFractionalMode = FractionalConfig.parseFractionalConfig(exclIt,
@@ -1037,6 +1037,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean hasNext()
{
return attrValIt.hasNext();
@@ -1045,6 +1046,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public String next()
{
return attrValIt.next().getValue().toString();
@@ -1054,6 +1056,7 @@
* {@inheritDoc}
*/
// Should not be needed anyway
+ @Override
public void remove()
{
attrValIt.remove();
@@ -1305,7 +1308,7 @@
concernedEntry.getObjectClasses().keySet());
boolean fractionalExclusive = fractionalConfig.isFractionalExclusive();
- if ( fractionalExclusive && (fractionalConcernedAttributes.size() == 0) )
+ if ( fractionalExclusive && (fractionalConcernedAttributes.isEmpty()) )
// No attributes to filter
return false;
@@ -1388,7 +1391,7 @@
List<String> fractionalConcernedAttributes =
createFractionalConcernedAttrList(fractionalConfig, classes.keySet());
boolean fractionalExclusive = fractionalConfig.isFractionalExclusive();
- if ( fractionalExclusive && (fractionalConcernedAttributes.size() == 0) )
+ if ( fractionalExclusive && (fractionalConcernedAttributes.isEmpty()) )
return false; // No attributes to filter
// Prepare list of object classes of the added entry
@@ -1525,8 +1528,7 @@
}
// Now overwrite the attribute values for the attribute types present in the
// RDN, if there are some filtered attributes in the RDN
- int index = 0;
- for (index = 0 ; index < rdnAttrTypes.size() ; index++)
+ for (int index = 0 ; index < rdnAttrTypes.size() ; index++)
{
attributesMap.put(rdnAttrTypes.get(index), newRdnAttrLists.get(index));
}
@@ -1623,13 +1625,13 @@
createFractionalConcernedAttrList(fractionalConfig,
modifiedEntry.getObjectClasses().keySet());
boolean fractionalExclusive = fractionalConfig.isFractionalExclusive();
- if ( fractionalExclusive && (fractionalConcernedAttributes.size() == 0) )
+ if ( fractionalExclusive && (fractionalConcernedAttributes.isEmpty()) )
// No attributes to filter
return FRACTIONAL_HAS_NO_FRACTIONAL_FILTERED_ATTRIBUTES;
// Prepare list of object classes of the modified entry
DN entryToModifyDn = modifyOperation.getEntryDN();
- Entry entryToModify = null;
+ Entry entryToModify;
try
{
entryToModify = DirectoryServer.getEntry(entryToModifyDn);
@@ -1706,7 +1708,7 @@
// Found a modification to remove, remove it from the list.
modsIt.remove();
result = FRACTIONAL_HAS_FRACTIONAL_FILTERED_ATTRIBUTES;
- if (mods.size() == 0)
+ if (mods.isEmpty())
{
// This operation must become a no-op as no more modification in
// it
@@ -2508,38 +2510,35 @@
private ModifyDNOperationBasis renameEntry(
DN targetDN, RDN newRDN, DN parentDN, boolean markConflict)
{
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
-
ModifyDNOperationBasis newOp =
- new ModifyDNOperationBasis(
- conn, InternalClientConnection.nextOperationID(),
- InternalClientConnection.nextMessageID(), new ArrayList<Control>(0),
- targetDN, newRDN, false,
- parentDN);
- newOp.setInternalOperation(true);
- newOp.setSynchronizationOperation(true);
- newOp.setDontSynchronize(true);
+ new ModifyDNOperationBasis(
+ conn, InternalClientConnection.nextOperationID(),
+ InternalClientConnection.nextMessageID(), new ArrayList<Control>(0),
+ targetDN, newRDN, false,
+ parentDN);
+ newOp.setInternalOperation(true);
+ newOp.setSynchronizationOperation(true);
+ newOp.setDontSynchronize(true);
- if (markConflict)
- {
- AttributeType attrType =
- DirectoryServer.getAttributeType(DS_SYNC_CONFLICT, true);
- Attribute attr = Attributes.create(attrType, AttributeValues.create(
- attrType, targetDN.toNormalizedString()));
- Modification mod = new Modification(ModificationType.REPLACE, attr);
- newOp.addModification(mod);
- }
- else
- {
- AttributeType attrType =
- DirectoryServer.getAttributeType(DS_SYNC_CONFLICT, true);
- Attribute attr = Attributes.empty(attrType);
- Modification mod = new Modification(ModificationType.DELETE, attr);
- newOp.addModification(mod);
- }
+ if (markConflict)
+ {
+ AttributeType attrType =
+ DirectoryServer.getAttributeType(DS_SYNC_CONFLICT, true);
+ Attribute attr = Attributes.create(attrType, AttributeValues.create(
+ attrType, targetDN.toNormalizedString()));
+ Modification mod = new Modification(ModificationType.REPLACE, attr);
+ newOp.addModification(mod);
+ }
+ else
+ {
+ AttributeType attrType =
+ DirectoryServer.getAttributeType(DS_SYNC_CONFLICT, true);
+ Attribute attr = Attributes.empty(attrType);
+ Modification mod = new Modification(ModificationType.DELETE, attr);
+ newOp.addModification(mod);
+ }
- newOp.run();
+ newOp.run();
return newOp;
}
@@ -2566,15 +2565,6 @@
return numReplayedPostOpCalled;
}
- /**
- * Get the debugCount.
- *
- * @return Returns the debugCount.
- */
- public int getDebugCount()
- {
- return debugCount;
- }
/**
* Delete this ReplicationDomain.
@@ -2961,7 +2951,7 @@
else if (result == ResultCode.NOT_ALLOWED_ON_RDN)
{
DN currentDN = findEntryDN(entryUid);
- RDN currentRDN = null;
+ RDN currentRDN;
if (currentDN != null)
{
currentRDN = currentDN.getRDN();
@@ -3125,7 +3115,7 @@
// Construct the new DN to use for the entry.
DN entryDN = op.getEntryDN();
- DN newSuperior = null;
+ DN newSuperior;
RDN newRDN = op.getNewRDN();
if (newSuperiorID != null)
@@ -3326,9 +3316,6 @@
boolean conflict = false;
// Find an rename child entries.
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
-
try
{
LinkedHashSet<String> attrs = new LinkedHashSet<String>(1);
@@ -3432,9 +3419,6 @@
private void markConflictEntry(Operation op, DN currentDN, DN conflictDN)
{
// create new internal modify operation and run it.
- InternalClientConnection conn =
- InternalClientConnection.getRootConnection();
-
AttributeType attrType = DirectoryServer.getAttributeType(DS_SYNC_CONFLICT,
true);
Attribute attr = Attributes.create(attrType, AttributeValues.create(
@@ -3603,13 +3587,11 @@
protected void loadDataState()
throws DirectoryException
{
- Long compatGenId = null;
-
state.clearInMemory();
state.loadState();
// Check to see if a Ruv needs to be translated
- compatGenId = state.checkRUVCompat();
+ Long compatGenId = state.checkRUVCompat();
generator.adjust(state.getMaxChangeNumber(serverId));
// Retrieves the generation ID associated with the data imported
@@ -3760,10 +3742,10 @@
* @return generationId The retrieved value of generationId
* @throws DirectoryException When an error occurs.
*/
- public long loadGenerationId()
+ private long loadGenerationId()
throws DirectoryException
{
- long generationId=-1;
+ long aGenerationId=-1;
if (debugEnabled())
TRACER.debugInfo(
@@ -3786,11 +3768,9 @@
* Search the database entry that is used to periodically
* save the generation id
*/
- SearchResultEntry resultEntry = null;
- InternalSearchOperation search = null;
LinkedHashSet<String> attributes = new LinkedHashSet<String>(1);
attributes.add(REPLICATION_GENERATION_ID);
- search = conn.processSearch(asn1BaseDn,
+ InternalSearchOperation search = conn.processSearch(asn1BaseDn,
SearchScope.BASE_OBJECT,
DereferencePolicy.DEREF_ALWAYS, 0, 0, false,
filter,attributes);
@@ -3824,7 +3804,7 @@
else
{
LinkedList<SearchResultEntry> result = search.getSearchEntries();
- resultEntry = result.getFirst();
+ SearchResultEntry resultEntry = result.getFirst();
if (resultEntry != null)
{
AttributeType synchronizationGenIDType =
@@ -3847,7 +3827,7 @@
found=true;
try
{
- generationId = Long.decode(attr.iterator().next().toString());
+ aGenerationId = Long.decode(attr.iterator().next().toString());
}
catch(Exception e)
{
@@ -3862,13 +3842,13 @@
if (!found)
{
- generationId = computeGenerationId();
- saveGenerationId(generationId);
+ aGenerationId = computeGenerationId();
+ saveGenerationId(aGenerationId);
if (debugEnabled())
TRACER.debugInfo("Generation ID created for domain base DN=" +
baseDn.toString() +
- " generationId=" + generationId);
+ " generationId=" + aGenerationId);
}
else
{
@@ -3876,9 +3856,9 @@
if (debugEnabled())
TRACER.debugInfo(
"Generation ID successfully read from domain base DN=" + baseDn +
- " generationId=" + generationId);
+ " generationId=" + aGenerationId);
}
- return generationId;
+ return aGenerationId;
}
/**
@@ -4014,7 +3994,7 @@
ResultCode.OTHER, message, null);
}
- OutputStream os = null;
+ OutputStream os;
ReplLDIFOutputStream ros = null;
if (checksumOutput)
@@ -4426,6 +4406,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public ConfigChangeResult applyConfigurationChange(
ReplicationDomainCfg configuration)
{
@@ -4477,6 +4458,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isConfigurationChangeAcceptable(
ReplicationDomainCfg configuration, List<Message> unacceptableReasons)
{
@@ -4504,6 +4486,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public LinkedHashMap<String, String> getAlerts()
{
LinkedHashMap<String,String> alerts = new LinkedHashMap<String,String>();
@@ -4516,6 +4499,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public String getClassName()
{
return CLASS_NAME;
@@ -4525,6 +4509,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public DN getComponentEntryDN()
{
return configDn;
@@ -4776,7 +4761,7 @@
}
}
- ChangeNumber lastRetrievedChange = null;
+ ChangeNumber lastRetrievedChange;
long missingChangesDelta;
InternalSearchOperation op;
ChangeNumber currentStartChangeNumber = startingChangeNumber;
@@ -5536,7 +5521,7 @@
*/
int fractionalConfigToInt()
{
- int fractionalMode = -1;
+ int fractionalMode;
if (fractional)
{
if (fractionalExclusive)
diff --git a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java b/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
index 38fc552..af277cc 100644
--- a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.replication.service;
@@ -1559,8 +1559,8 @@
// - sleep to let time to the other peer to reconnect if needed
// - and launch another attempt
try { Thread.sleep(1000); } catch(Exception e){}
- logError(NOTE_RESENDING_INIT_TARGET.get((exportRootException!=null?
- exportRootException.getLocalizedMessage():"")));
+ logError(NOTE_RESENDING_INIT_TARGET.get(
+ exportRootException.getLocalizedMessage()));
continue;
}
diff --git a/opends/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java
index faaf3ed..9db9bc3 100644
--- a/opends/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java
+++ b/opends/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2012 ForgeRock AS
*/
package org.opends.server.schema;
@@ -40,18 +41,7 @@
import java.nio.CharBuffer;
import java.text.CollationKey;
import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
+import java.util.*;
import org.opends.messages.Message;
import org.opends.server.admin.server.ConfigurationChangeListener;
@@ -120,10 +110,7 @@
static
{
supportedLocales = new HashSet<Locale>();
- for (Locale l : Locale.getAvailableLocales())
- {
- supportedLocales.add(l);
- }
+ supportedLocales.addAll(Arrays.asList(Locale.getAvailableLocales()));
}
@@ -158,7 +145,7 @@
* @param matchingRule
* instance of a MatchingRule.
*/
- private final void addMatchingRule(String oid,
+ private void addMatchingRule(String oid,
MatchingRule matchingRule)
{
matchingRules.put(oid, matchingRule);
@@ -173,7 +160,7 @@
* OID of the matching rule to be searched.
* @return MatchingRule corresponding to an OID.
*/
- private final MatchingRule getMatchingRule(String oid)
+ private MatchingRule getMatchingRule(String oid)
{
return matchingRules.get(oid);
}
@@ -316,6 +303,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public ConfigChangeResult applyConfigurationChange(
CollationMatchingRuleCfg configuration)
{
@@ -386,6 +374,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isConfigurationChangeAcceptable(
CollationMatchingRuleCfg configuration,
List<Message> unacceptableReasons)
@@ -677,27 +666,25 @@
*
* @param lTag
* The language tag specified in the configuration.
- * @return Locale The locale correspoding to the languageTag.
+ * @return Locale The locale corresponding to the languageTag.
*/
private Locale getLocale(String lTag)
{
// Separates the language and the country from the locale.
Locale locale;
- String lang = null;
- String country = null;
- String variant = null;
int countryIndex = lTag.indexOf("-");
int variantIndex = lTag.lastIndexOf("-");
if (countryIndex > 0)
{
- lang = lTag.substring(0, countryIndex);
+ String lang = lTag.substring(0, countryIndex);
+ String country;
if (variantIndex > countryIndex)
{
country = lTag.substring(countryIndex + 1, variantIndex);
- variant = lTag.substring(variantIndex + 1, lTag.length());
+ String variant = lTag.substring(variantIndex + 1, lTag.length());
locale = new Locale(lang, country, variant);
}
else
@@ -708,7 +695,6 @@
}
else
{
- lang = lTag;
locale = new Locale(lTag);
}
@@ -856,6 +842,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Collection<ExtensibleIndexer> getIndexers(IndexConfig config)
{
if (indexer == null)
@@ -939,6 +926,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public <T> T createIndexQuery(ByteSequence assertionValue,
IndexQueryFactory<T> factory) throws DirectoryException
{
@@ -952,6 +940,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int compare(byte[] arg0, byte[] arg1)
{
return StaticUtils.compare(arg0, arg1);
@@ -1260,7 +1249,7 @@
// initialLength, initial, numberofany, anyLength1, any1,
// anyLength2, any2, ..., anyLengthn, anyn, finalLength,
// final
- CollationKey key = null;
+ CollationKey key;
List<Integer> normalizedList = new ArrayList<Integer>();
if (subInitial == null)
@@ -1282,7 +1271,7 @@
}
List<String> subAny = assertion.getAny();
- if (subAny.size() == 0)
+ if (subAny.isEmpty())
{
normalizedList.add(0);
}
@@ -1339,7 +1328,6 @@
{
int valueLength = attributeValue.length() - 4;
int valuePos = 0; // position in the value bytes array.
- int assertPos = 0; // position in the assertion bytes array.
// First byte is the length of subInitial.
int subInitialLength = 0xFF & assertionValue.byteAt(0);
@@ -1361,7 +1349,7 @@
}
}
- assertPos = subInitialLength + 1;
+ int assertPos = subInitialLength + 1;
int anySize = 0xFF & assertionValue.byteAt(assertPos++);
if (anySize != 0)
{
@@ -1416,8 +1404,6 @@
return ConditionResult.FALSE;
}
- valuePos = valueLength - finalLength;
-
if (finalLength != assertionValue.length() - assertPos)
{
// Some issue with the encoding.
@@ -1615,7 +1601,7 @@
private <T> T matchSubstring(String value,
IndexQueryFactory<T> factory)
{
- T intersectionQuery = null;
+ T intersectionQuery;
int substrLength = subIndexer.gerSubstringLength();
if (value.length() < substrLength)
@@ -1674,6 +1660,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public <T> T createIndexQuery(ByteSequence assertionValue,
IndexQueryFactory<T> factory) throws DirectoryException
{
@@ -1683,7 +1670,7 @@
String subFinal = assertion.getFinal();
List<T> queries = new ArrayList<T>();
- if (subInitial == null && subAny.size() == 0 && subFinal == null)
+ if (subInitial == null && subAny.isEmpty() && subFinal == null)
{
// Can happen with a filter like "cn:en.6:=*".
// Just return an empty record.
@@ -1767,6 +1754,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int compare(byte[] arg0, byte[] arg1)
{
return StaticUtils.compare(arg0, arg1);
@@ -1777,6 +1765,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int compareValues(ByteSequence value1, ByteSequence value2)
{
return value1.compareTo(value2);
@@ -1841,6 +1830,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public <T> T createIndexQuery(ByteSequence assertionValue,
IndexQueryFactory<T> factory) throws DirectoryException
{
@@ -1908,6 +1898,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public <T> T createIndexQuery(ByteSequence assertionValue,
IndexQueryFactory<T> factory) throws DirectoryException
{
@@ -1976,6 +1967,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public <T> T createIndexQuery(ByteSequence assertionValue,
IndexQueryFactory<T> factory) throws DirectoryException
{
@@ -2043,6 +2035,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public <T> T createIndexQuery(ByteSequence assertionValue,
IndexQueryFactory<T> factory) throws DirectoryException
{
diff --git a/opends/src/server/org/opends/server/tools/ManageTasks.java b/opends/src/server/org/opends/server/tools/ManageTasks.java
index 620a28a..665ca65 100644
--- a/opends/src/server/org/opends/server/tools/ManageTasks.java
+++ b/opends/src/server/org/opends/server/tools/ManageTasks.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2012 ForgeRock AS
*/
package org.opends.server.tools;
@@ -73,7 +74,7 @@
private static ErrorLogPublisher errorLogPublisher = null;
// This CLI is always using the administration connector with SSL
- private final boolean alwaysSSL = true;
+ private static final boolean alwaysSSL = true;
/**
* The main method for TaskInfo tool.
@@ -346,6 +347,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isAdvancedMode() {
return false;
}
@@ -353,6 +355,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isInteractive() {
return !noPrompt.isPresent();
}
@@ -360,6 +363,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isMenuDrivenMode() {
return !task.isPresent() && !cancel.isPresent() && !summary.isPresent() &&
!noPrompt.isPresent();
@@ -368,6 +372,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isQuiet() {
return false;
}
@@ -375,6 +380,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isScriptFriendly() {
return false;
}
@@ -382,6 +388,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isVerbose() {
return false;
}
@@ -513,6 +520,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public MenuResult<Void> invoke(ConsoleApplication app) throws CLIException {
return invoke((ManageTasks)app);
}
@@ -550,6 +558,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public MenuResult<TaskEntry> invoke(ConsoleApplication app)
throws CLIException
{
@@ -569,6 +578,7 @@
*/
static private class PrintSummaryTop extends TopMenuCallback {
+ @Override
public MenuResult<Void> invoke(ManageTasks app)
throws CLIException
{
@@ -598,6 +608,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public MenuResult<Void> invoke(ManageTasks app) throws CLIException {
MenuResult<TaskEntry> res = new PrintTaskInfo(taskId).invoke(app);
TaskEntry taskEntry = res.getValue();
@@ -664,11 +675,12 @@
/**
* {@inheritDoc}
*/
+ @Override
public MenuResult<TaskEntry> invoke(ManageTasks app)
throws CLIException
{
- Message m = null;
- TaskEntry taskEntry = null;
+ Message m;
+ TaskEntry taskEntry;
try {
taskEntry = app.getTaskClient().getTaskEntry(taskId);
@@ -824,9 +836,9 @@
Message noneLabel) {
table.startRow();
table.appendCell(fieldLabel);
- if (values.size() == 0) {
+ if (values.isEmpty()) {
table.appendCell(noneLabel);
- } else if (values.size() > 0) {
+ } else {
table.appendCell(values.get(0));
}
if (values.size() > 1) {
@@ -856,6 +868,7 @@
/**
* {@inheritDoc}
*/
+ @Override
protected MenuResult<TaskEntry> invoke(ManageTasks app)
throws CLIException
{
@@ -916,6 +929,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public MenuResult<Void> invoke(ManageTasks app)
throws CLIException
{
@@ -988,6 +1002,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public MenuResult<TaskEntry> invoke(ManageTasks app)
throws CLIException
{
diff --git a/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java b/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
index 7e0f55b..1c36af6 100644
--- a/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
+++ b/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2007-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2012 ForgeRock AS
*/
package org.opends.server.tools.dsreplication;
@@ -324,7 +325,7 @@
public static final String PURGE_HISTORICAL_SUBCMD_NAME = "purge-historical";
// This CLI is always using the administration connector with SSL
- private final boolean alwaysSSL = true;
+ private static final boolean alwaysSSL = true;
/**
* Creates a new instance of this argument parser with no arguments.
diff --git a/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java b/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
index f24fa05..7828095 100644
--- a/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
+++ b/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2007-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.tools.dsreplication;
@@ -8204,7 +8204,7 @@
Set<String> servers = domain.getReplicationServer();
if (servers == null)
{
- domain.setReplicationServer(servers);
+ domain.setReplicationServer(null);
mustCommit = true;
}
else if (!areReplicationServersEqual(servers, replicationServers))
diff --git a/opends/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java b/opends/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java
index 98f3b54..1098fb9 100644
--- a/opends/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java
+++ b/opends/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2012 ForgeRock AS
*/
package org.opends.server.tools.status;
@@ -54,7 +55,7 @@
private BooleanArgument noPromptArg;
// This CLI is always using the administration connector with SSL
- private final boolean alwaysSSL = true;
+ private static final boolean alwaysSSL = true;
/**
diff --git a/opends/src/server/org/opends/server/tools/tasks/TaskTool.java b/opends/src/server/org/opends/server/tools/tasks/TaskTool.java
index 7c3e5af..9e4240e 100644
--- a/opends/src/server/org/opends/server/tools/tasks/TaskTool.java
+++ b/opends/src/server/org/opends/server/tools/tasks/TaskTool.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2007-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2012 ForgeRock AS
*/
package org.opends.server.tools.tasks;
@@ -98,7 +99,7 @@
private BooleanArgument testIfOfflineArg;
// This CLI is always using the administration connector with SSL
- private final boolean alwaysSSL = true;
+ private static final boolean alwaysSSL = true;
/**
* Called when this utility should perform its actions locally in this
@@ -191,6 +192,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Date getStartDateTime() {
return taskScheduleArgs.getStartDateTime();
}
@@ -198,6 +200,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public String getRecurringDateTime() {
return taskScheduleArgs.getRecurringDateTime();
}
@@ -205,6 +208,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<String> getDependencyIds() {
return taskScheduleArgs.getDependencyIds();
}
@@ -212,6 +216,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public FailedDependencyAction getFailedDependencyAction() {
return taskScheduleArgs.getFailedDependencyAction();
}
@@ -219,6 +224,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<String> getNotifyUponCompletionEmailAddresses() {
return taskScheduleArgs.getNotifyUponCompletionEmailAddresses();
}
@@ -226,6 +232,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<String> getNotifyUponErrorEmailAddresses() {
return taskScheduleArgs.getNotifyUponErrorEmailAddresses();
}
@@ -344,7 +351,7 @@
}
ret = 0;
} catch (LDAPConnectionException e) {
- Message message = null;
+ Message message;
if (isWrongPortException(e,
new Integer(argParser.getArguments().getPort())))
{
diff --git a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
index def6b50..774b34a 100644
--- a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
+++ b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.workflowelement.localbackend;
@@ -84,7 +84,7 @@
// A string indicating the type of the workflow element.
- private final String BACKEND_WORKFLOW_ELEMENT = "Backend";
+ private static final String BACKEND_WORKFLOW_ELEMENT = "Backend";
/**
@@ -171,6 +171,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean isConfigurationChangeAcceptable(
LocalBackendWorkflowElementCfg configuration,
List<Message> unacceptableReasons
@@ -186,6 +187,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public ConfigChangeResult applyConfigurationChange(
LocalBackendWorkflowElementCfg configuration
)
@@ -275,10 +277,9 @@
String workflowElementID,
Backend backend)
{
- LocalBackendWorkflowElement localBackend = null;
-
// If the requested workflow element does not exist then create one.
- localBackend = registeredLocalBackends.get(workflowElementID);
+ LocalBackendWorkflowElement localBackend =
+ registeredLocalBackends.get(workflowElementID);
if (localBackend == null)
{
localBackend = new LocalBackendWorkflowElement();
@@ -532,6 +533,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void execute(Operation operation) throws CanceledOperationException {
switch (operation.getOperationType())
{
@@ -602,7 +604,7 @@
* operation
*/
@SuppressWarnings("unchecked")
- public static final <O extends Operation,L> void
+ public static <O extends Operation,L> void
attachLocalOperation (O globalOperation, L currentLocalOperation)
{
List<?> existingAttachment =
@@ -652,6 +654,7 @@
PersistentSearch.CancellationCallback callback =
new PersistentSearch.CancellationCallback()
{
+ @Override
public void persistentSearchCancelled(PersistentSearch psearch)
{
persistentSearches.remove(psearch);
--
Gitblit v1.10.0