From 9fbd53da43e97e214a1e57f70b055d66e6e22b5b Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 08 Apr 2015 11:35:19 +0000
Subject: [PATCH] Code cleanup
---
opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java | 60 ++++++++++++++++++++++--------------------------------------
1 files changed, 22 insertions(+), 38 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java
index 792f4ec..9650ef2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java
@@ -26,28 +26,27 @@
*/
package org.opends.server.tools;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
-
-import org.opends.server.api.Backend;
-import org.opends.server.config.ConfigEntry;
-import org.forgerock.opendj.config.server.ConfigException;
-import org.opends.server.config.StringConfigAttribute;
-import org.opends.server.config.DNConfigAttribute;
-import org.opends.server.types.DN;
-import org.opends.server.types.DirectoryException;
-import org.opends.server.core.DirectoryServer;
-
-import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.messages.ToolMessages.*;
-import static org.opends.messages.ConfigMessages.*;
-import static org.opends.server.util.StaticUtils.*;
-import org.opends.server.admin.std.server.BackendCfg;
-import org.opends.server.admin.std.server.RootCfg;
-import org.opends.server.admin.server.ServerManagementContext;
-
import java.util.ArrayList;
import java.util.List;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.config.server.ConfigException;
+import org.opends.server.admin.server.ServerManagementContext;
+import org.opends.server.admin.std.server.BackendCfg;
+import org.opends.server.admin.std.server.RootCfg;
+import org.opends.server.api.Backend;
+import org.opends.server.config.ConfigEntry;
+import org.opends.server.config.DNConfigAttribute;
+import org.opends.server.config.StringConfigAttribute;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.types.DN;
+import org.opends.server.types.DirectoryException;
+
+import static org.opends.messages.ConfigMessages.*;
+import static org.opends.messages.ToolMessages.*;
+import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.util.StaticUtils.*;
+
/**
* This class provides utility functions for all JE related client tools.
*/
@@ -88,13 +87,8 @@
for (final ConfigEntry configEntry : baseEntry.getChildren().values())
{
final String backendID = getBackendID(configEntry);
- if (backendID == null)
- {
- continue;
- }
-
final String backendClassName = getBackendClassName(configEntry);
- if (backendClassName == null)
+ if (backendID == null || backendClassName == null)
{
continue;
}
@@ -137,22 +131,18 @@
final DNConfigAttribute baseDNStub = new DNConfigAttribute(
ATTR_BACKEND_BASE_DN, INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS.get(), true, true, true);
final DNConfigAttribute baseDNAttr = (DNConfigAttribute) configEntry.getConfigAttribute(baseDNStub);
- if (baseDNAttr == null)
- {
- logger.error(ERR_NO_BASES_FOR_BACKEND, configEntry.getDN());
- }
- else
+ if (baseDNAttr != null)
{
return baseDNAttr.activeValues();
}
+ logger.error(ERR_NO_BASES_FOR_BACKEND, configEntry.getDN());
+ return null;
}
catch (final Exception e)
{
logger.error(ERR_CANNOT_DETERMINE_BASES_FOR_BACKEND, configEntry.getDN(), getExceptionMessage(e));
throw e;
}
-
- return null;
}
private static Class<?> getBackendClass(String backendClassName, ConfigEntry configEntry) throws Exception
@@ -175,11 +165,6 @@
final StringConfigAttribute classStub = new StringConfigAttribute(
ATTR_BACKEND_CLASS, INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_CLASS.get(), true, false, false);
final StringConfigAttribute classAttr = (StringConfigAttribute) configEntry.getConfigAttribute(classStub);
- if (classAttr == null)
- {
- return null;
- }
-
return classAttr != null ? classAttr.activeValue() : null;
}
catch (final org.opends.server.config.ConfigException ce)
@@ -201,7 +186,6 @@
final StringConfigAttribute idStub = new StringConfigAttribute(
ATTR_BACKEND_ID, INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BACKEND_ID.get(), true, false, true);
final StringConfigAttribute idAttr = (StringConfigAttribute) configEntry.getConfigAttribute(idStub);
-
return idAttr != null ? idAttr.activeValue() : null;
}
catch (final org.opends.server.config.ConfigException ce)
--
Gitblit v1.10.0