From ba07fc549fdcfe6d30524daf17ad33832b0efc75 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 11 Mar 2014 09:18:47 +0000
Subject: [PATCH] EntryContainer.java: Matt said we can get rid of the KeyReverseComparator: "It is not used any more, but has been kept for backwards compatibility with OpenDS 2.2 (the comparator is persisted in the JE database)"
---
opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java | 21 +++---
opendj3-server-dev/src/server/org/opends/server/schema/CoreSchemaProvider.java | 12 ++--
opendj3-server-dev/src/server/org/opends/server/backends/jeb/EntryContainer.java | 52 -----------------
opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java | 38 +++++-------
opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java | 12 +---
opendj3-server-dev/src/server/org/opends/server/loggers/DebugLogPublisher.java | 2
6 files changed, 37 insertions(+), 100 deletions(-)
diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java
index 1d45482..4210c83 100755
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java
@@ -505,14 +505,10 @@
*/
public static final char[] readPassword() throws ClientException {
try {
- char[] password = System.console().readPassword();
- if (password != null) {
- return password;
- }
+ return System.console().readPassword();
} catch (IOError e) {
throw ClientException.adaptInputException(e);
}
- return null;
}
/**
@@ -533,9 +529,8 @@
final String s = reader.readLine();
if (s == null) {
throw ClientException.adaptInputException(new EOFException("End of input"));
- } else {
- return s;
}
+ return s;
} catch (final IOException e) {
throw ClientException.adaptInputException(e);
}
@@ -559,20 +554,20 @@
final String ninput = input.trim();
if (ninput.length() == 0) {
return defaultValue;
- } else {
- try {
- int i = Integer.parseInt(ninput);
- if (i < 1 || i > 65535) {
- throw new NumberFormatException();
- }
- return i;
- } catch (NumberFormatException e) {
- // Try again...
- app.println();
- app.println(ERR_BAD_PORT_NUMBER.get(ninput));
- app.println();
- return null;
+ }
+
+ try {
+ int i = Integer.parseInt(ninput);
+ if (i < 1 || i > 65535) {
+ throw new NumberFormatException();
}
+ return i;
+ } catch (NumberFormatException e) {
+ // Try again...
+ app.println();
+ app.println(ERR_BAD_PORT_NUMBER.get(ninput));
+ app.println();
+ return null;
}
}
@@ -658,9 +653,8 @@
private PrintStream getErrStream() {
if (isInteractive()) {
return out;
- } else {
- return err;
}
+ return err;
}
/**
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java b/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
index 971063a..d9b3cf7 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -53,6 +53,7 @@
import org.opends.guitools.controlpanel.datamodel.ConnectionProtocolPolicy;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.quicksetup.*;
+import org.opends.quicksetup.ReturnCode;
import org.opends.quicksetup.event.ProgressUpdateEvent;
import org.opends.quicksetup.event.ProgressUpdateListener;
import org.opends.quicksetup.util.PlainTextProgressMessageFormatter;
@@ -62,13 +63,11 @@
import org.opends.server.tools.JavaPropertiesTool.ErrorReturnCode;
import org.opends.server.tools.dsconfig.LDAPManagementContextFactory;
import org.opends.server.util.StaticUtils;
-
-import com.forgerock.opendj.cli.ConsoleApplication;
-
import org.opends.server.util.cli.LDAPConnectionConsoleInteraction;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ClientException;
+import com.forgerock.opendj.cli.ConsoleApplication;
import com.forgerock.opendj.cli.Menu;
import com.forgerock.opendj.cli.MenuBuilder;
import com.forgerock.opendj.cli.MenuResult;
@@ -76,7 +75,7 @@
import static org.forgerock.util.Utils.*;
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.QuickSetupMessages.*;
-import static com.forgerock.opendj.cli.Utils.CONFIRMATION_MAX_TRIES;
+import static com.forgerock.opendj.cli.Utils.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
/**
@@ -967,9 +966,9 @@
return s;
}
- private boolean startServer(boolean supressOutput)
+ private boolean startServer(boolean suppressOutput)
{
- logger.info(LocalizableMessage.raw("startServer, supressOutput: "+supressOutput));
+ logger.info(LocalizableMessage.raw("startServer, suppressOutput: " + suppressOutput));
boolean serverStarted = false;
Application application = new Application()
{
@@ -1083,7 +1082,7 @@
};
application.setProgressMessageFormatter(
new PlainTextProgressMessageFormatter());
- if (!supressOutput)
+ if (!suppressOutput)
{
application.addProgressUpdateListener(
new ProgressUpdateListener() {
@@ -1098,12 +1097,12 @@
Installation.getLocal());
try
{
- if (!supressOutput)
+ if (!suppressOutput)
{
println();
}
- controller.startServer(supressOutput);
- if (!supressOutput)
+ controller.startServer(suppressOutput);
+ if (!suppressOutput)
{
println();
}
@@ -1114,7 +1113,7 @@
catch (ApplicationException ae)
{
logger.warn(LocalizableMessage.raw("ApplicationException: "+ae, ae));
- if (!supressOutput)
+ if (!suppressOutput)
{
printErrorMessage(ae.getMessageObject());
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java b/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java
index 822f17d..ca0a504 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java
@@ -156,17 +156,13 @@
protected String getBindPassword(String dn, OutputStream out,
OutputStream err, StringArgument pwdArg, FileBasedArgument fileArg)
{
- String bindPasswordValue = null;
if (fileArg.isPresent())
{
return fileArg.getValue();
}
- else if (pwdArg.isPresent())
- {
- bindPasswordValue = pwdArg.getValue();
- }
- if ((bindPasswordValue != null && "-".equals(bindPasswordValue))
- || bindPasswordValue == null)
+
+ String bindPasswordValue = pwdArg.isPresent() ? pwdArg.getValue() : null;
+ if (bindPasswordValue == null || "-".equals(bindPasswordValue))
{
// Read the password from the STDin.
try
@@ -267,7 +263,6 @@
setNoPropertiesFileArgument(noPropertiesFileArg);
set.add(noPropertiesFileArg);
-
return set;
}
@@ -296,7 +291,6 @@
ArgumentGroup argGroup)
throws ArgumentException
{
-
for (Argument arg : args)
{
addGlobalArgument(arg, argGroup);
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/EntryContainer.java b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/EntryContainer.java
index 7cc4e61..8751eb8 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/EntryContainer.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/EntryContainer.java
@@ -2863,58 +2863,6 @@
}
/**
- * A lexicographic byte array comparator that compares in
- * reverse byte order. This is used for the dn2id database of version 2.2.
- * If we want to find all the entries in a subtree dc=com we know that
- * all subordinate entries must have ,dc=com as a common suffix. In reversing
- * the order of comparison we turn the subtree base into a common prefix
- * and are able to iterate through the keys having that prefix.
- * Keep in there to preserve ability to upgrade
- */
- static public class KeyReverseComparator implements Comparator<byte[]>
- {
- /**
- * Compares its two arguments for order. Returns a negative integer,
- * zero, or a positive integer as the first argument is less than, equal
- * to, or greater than the second.
- *
- * @param a the first object to be compared.
- * @param b the second object to be compared.
- * @return a negative integer, zero, or a positive integer as the
- * first argument is less than, equal to, or greater than the
- * second.
- */
- @Override
- public int compare(byte[] a, byte[] b)
- {
- for (int ai = a.length - 1, bi = b.length - 1;
- ai >= 0 && bi >= 0; ai--, bi--)
- {
- if (a[ai] > b[bi])
- {
- return 1;
- }
- else if (a[ai] < b[bi])
- {
- return -1;
- }
- }
- if (a.length == b.length)
- {
- return 0;
- }
- if (a.length > b.length)
- {
- return 1;
- }
- else
- {
- return -1;
- }
- }
- }
-
- /**
* Insert a new entry into the attribute indexes.
*
* @param txn The database transaction to be used for the updates.
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/DebugLogPublisher.java b/opendj3-server-dev/src/server/org/opends/server/loggers/DebugLogPublisher.java
index 3a1cca6..fcbe1d6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/DebugLogPublisher.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/DebugLogPublisher.java
@@ -135,7 +135,9 @@
{
int clipPoint = searchName.lastIndexOf('$');
if (clipPoint == -1)
+ {
clipPoint = searchName.lastIndexOf('.');
+ }
if (clipPoint != -1)
{
searchName = searchName.substring(0, clipPoint);
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/CoreSchemaProvider.java b/opendj3-server-dev/src/server/org/opends/server/schema/CoreSchemaProvider.java
index 0154ad5..43bacfd 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/CoreSchemaProvider.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/CoreSchemaProvider.java
@@ -85,18 +85,18 @@
for (final String oid : configuration.getDisabledMatchingRule())
{
- if (oid.equals(NONE_ELEMENT)) {
- break;
+ if (!oid.equals(NONE_ELEMENT))
+ {
+ schemaBuilder.removeMatchingRule(oid);
}
- schemaBuilder.removeMatchingRule(oid);
}
for (final String oid : configuration.getDisabledSyntax())
{
- if (oid.equals(NONE_ELEMENT)) {
- break;
+ if (!oid.equals(NONE_ELEMENT))
+ {
+ schemaBuilder.removeSyntax(oid);
}
- schemaBuilder.removeSyntax(oid);
}
}
--
Gitblit v1.10.0