From 594c090e932966e1e41f70bd69d746556eaea99d Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 15 Jan 2014 23:34:37 +0000
Subject: [PATCH] Removed some classes and methods:
---
opendj-config/src/main/java/org/forgerock/opendj/config/server/ConfigException.java | 2
/dev/null | 107 ---------------------
opendj-config/src/main/java/org/opends/server/core/DirectoryServer.java | 31 ------
opendj-config/src/main/java/org/forgerock/opendj/config/ClassLoaderProvider.java | 70 +++++++-------
opendj-config/src/test/java/org/forgerock/opendj/config/DNPropertyDefinitionTest.java | 7
opendj-config/src/main/java/org/forgerock/opendj/config/ACIPropertyDefinition.java | 5
opendj-config/src/main/java/org/forgerock/opendj/config/AdminException.java | 15 ++
opendj-config/src/main/java/org/opends/server/authorization/dseecompat/Aci.java | 5
8 files changed, 54 insertions(+), 188 deletions(-)
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/ACIPropertyDefinition.java b/opendj-config/src/main/java/org/forgerock/opendj/config/ACIPropertyDefinition.java
index a43333f..044f8db 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/ACIPropertyDefinition.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/ACIPropertyDefinition.java
@@ -27,9 +27,8 @@
package org.forgerock.opendj.config;
import org.forgerock.util.Reject;
-
import org.opends.server.authorization.dseecompat.Aci;
-import org.opends.server.authorization.dseecompat.AciException;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
@@ -101,7 +100,7 @@
try {
return Aci.decode(ByteString.valueOf(value), DN.rootDN());
- } catch (AciException e) {
+ } catch (LocalizedIllegalArgumentException e) {
// TODO: it would be nice to throw the cause.
throw new IllegalPropertyValueStringException(this, value);
}
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/AdminException.java b/opendj-config/src/main/java/org/forgerock/opendj/config/AdminException.java
index 4e0df01..28eea12 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/AdminException.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/AdminException.java
@@ -26,13 +26,14 @@
package org.forgerock.opendj.config;
+import org.forgerock.i18n.LocalizableException;
import org.forgerock.i18n.LocalizableMessage;
-import org.opends.server.types.OpenDsException;
/**
* Exceptions thrown when interacting with administration framework.
*/
-public abstract class AdminException extends OpenDsException {
+public abstract class AdminException extends Exception implements LocalizableException {
+ private final LocalizableMessage message;
/**
* Fake serialization ID.
@@ -48,7 +49,8 @@
* The cause.
*/
protected AdminException(LocalizableMessage message, Throwable cause) {
- super(message, cause);
+ super(cause);
+ this.message = message;
}
/**
@@ -58,6 +60,11 @@
* The message.
*/
protected AdminException(LocalizableMessage message) {
- super(message);
+ this.message = message;
+ }
+
+ @Override
+ public LocalizableMessage getMessageObject() {
+ return message;
}
}
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/ClassLoaderProvider.java b/opendj-config/src/main/java/org/forgerock/opendj/config/ClassLoaderProvider.java
index a7d9b54..f86c9e5 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/ClassLoaderProvider.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/ClassLoaderProvider.java
@@ -56,9 +56,9 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.server.config.meta.RootCfgDefn;
import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.InitializationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -179,7 +179,7 @@
* The names of the extensions to be loaded. The names should not
* contain any path elements and must be located within the
* extensions folder.
- * @throws InitializationException
+ * @throws ConfigException
* If one of the extensions could not be loaded and initialized.
* @throws IllegalStateException
* If this class loader provider is disabled.
@@ -187,7 +187,7 @@
* If one of the extension names was not a single relative path
* name element or was an absolute path.
*/
- public synchronized void addExtension(String... extensions) throws InitializationException {
+ public synchronized void addExtension(String... extensions) throws ConfigException {
Reject.ifNull(extensions);
if (loader == null) {
@@ -236,13 +236,13 @@
* Enable this class loader provider using the application's class loader as
* the parent class loader.
*
- * @throws InitializationException
+ * @throws ConfigException
* If the class loader provider could not initialize
* successfully.
* @throws IllegalStateException
* If this class loader provider is already enabled.
*/
- public synchronized void enable() throws InitializationException {
+ public synchronized void enable() throws ConfigException {
enable(RootCfgDefn.class.getClassLoader());
}
@@ -251,13 +251,13 @@
*
* @param parent
* The parent class loader.
- * @throws InitializationException
+ * @throws ConfigException
* If the class loader provider could not initialize
* successfully.
* @throws IllegalStateException
* If this class loader provider is already enabled.
*/
- public synchronized void enable(ClassLoader parent) throws InitializationException {
+ public synchronized void enable(ClassLoader parent) throws ConfigException {
if (loader != null) {
throw new IllegalStateException("Class loader provider already enabled.");
}
@@ -335,10 +335,10 @@
*
* @param extensions
* The names of the extensions to be loaded.
- * @throws InitializationException
+ * @throws ConfigException
* If one of the extensions could not be loaded and initialized.
*/
- private synchronized void addExtension(File... extensions) throws InitializationException {
+ private synchronized void addExtension(File... extensions) throws ConfigException {
// First add the Jar files to the class loader.
List<JarFile> jars = new LinkedList<JarFile>();
for (File extension : extensions) {
@@ -358,7 +358,7 @@
LocalizableMessage message =
ERR_ADMIN_CANNOT_OPEN_JAR_FILE.get(extension.getName(), extension.getParent(),
stackTraceToSingleLineString(e, true));
- throw new InitializationException(message);
+ throw new ConfigException(message);
}
jarFiles.add(extension);
}
@@ -477,12 +477,12 @@
*
* @param extensionsPath
* Indicates where extensions are located.
- * @throws InitializationException
+ * @throws ConfigException
* If the extensions folder could not be accessed or if a
* extension jar file could not be accessed or if one of the
* configuration definition classes could not be initialized.
*/
- private void initializeAllExtensions(File extensionsPath) throws InitializationException {
+ private void initializeAllExtensions(File extensionsPath) throws ConfigException {
try {
if (!extensionsPath.exists()) {
@@ -497,7 +497,7 @@
// critical.
LocalizableMessage message =
ERR_ADMIN_EXTENSIONS_DIR_NOT_DIRECTORY.get(String.valueOf(extensionsPath));
- throw new InitializationException(message);
+ throw new ConfigException(message);
}
// Get each extension file name.
@@ -519,7 +519,7 @@
// Add and initialize the extensions.
addExtension(extensionsPath.listFiles(filter));
- } catch (InitializationException e) {
+ } catch (ConfigException e) {
debugLogger.trace("Unable to initialize all extensions", e);
throw e;
} catch (Exception e) {
@@ -527,31 +527,31 @@
LocalizableMessage message =
ERR_ADMIN_EXTENSIONS_CANNOT_LIST_FILES.get(String.valueOf(extensionsPath),
stackTraceToSingleLineString(e, true));
- throw new InitializationException(message, e);
+ throw new ConfigException(message, e);
}
}
/**
* Make sure all core configuration definitions are loaded.
*
- * @throws InitializationException
+ * @throws ConfigException
* If the core manifest file could not be read or if one of the
* configuration definition classes could not be initialized.
*/
- private void initializeCoreComponents() throws InitializationException {
+ private void initializeCoreComponents() throws ConfigException {
InputStream is = RootCfgDefn.class.getResourceAsStream(MANIFEST);
if (is == null) {
LocalizableMessage message = ERR_ADMIN_CANNOT_FIND_CORE_MANIFEST.get(MANIFEST);
- throw new InitializationException(message);
+ throw new ConfigException(message);
}
try {
loadDefinitionClasses(is);
- } catch (InitializationException e) {
+ } catch (ConfigException e) {
debugLogger.trace("Unable to initialize core components", e);
LocalizableMessage message =
ERR_CLASS_LOADER_CANNOT_LOAD_CORE.get(MANIFEST,
stackTraceToSingleLineString(e, true));
- throw new InitializationException(message);
+ throw new ConfigException(message);
}
}
@@ -561,12 +561,12 @@
*
* @param jarFile
* The extension's Jar file.
- * @throws InitializationException
+ * @throws ConfigException
* If the extension jar file could not be accessed or if one of
* the configuration definition classes could not be
* initialized.
*/
- private void initializeExtension(JarFile jarFile) throws InitializationException {
+ private void initializeExtension(JarFile jarFile) throws ConfigException {
JarEntry entry = jarFile.getJarEntry(MANIFEST);
if (entry != null) {
InputStream is;
@@ -577,17 +577,17 @@
LocalizableMessage message =
ERR_ADMIN_CANNOT_READ_EXTENSION_MANIFEST.get(MANIFEST, jarFile.getName(),
stackTraceToSingleLineString(e, true));
- throw new InitializationException(message);
+ throw new ConfigException(message);
}
try {
loadDefinitionClasses(is);
- } catch (InitializationException e) {
+ } catch (ConfigException e) {
debugLogger.trace("Unable to load classes from input stream", e);
LocalizableMessage message =
ERR_CLASS_LOADER_CANNOT_LOAD_EXTENSION.get(jarFile.getName(), MANIFEST,
stackTraceToSingleLineString(e, true));
- throw new InitializationException(message);
+ throw new ConfigException(message);
}
try {
// Log build information of extensions in the error log
@@ -607,11 +607,11 @@
*
* @param is
* The manifest file input stream.
- * @throws InitializationException
+ * @throws ConfigException
* If the definition classes could not be loaded and
* initialized.
*/
- private void loadDefinitionClasses(InputStream is) throws InitializationException {
+ private void loadDefinitionClasses(InputStream is) throws ConfigException {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
List<AbstractManagedObjectDefinition<?, ?>> definitions =
new LinkedList<AbstractManagedObjectDefinition<?, ?>>();
@@ -622,7 +622,7 @@
} catch (IOException e) {
LocalizableMessage msg =
ERR_CLASS_LOADER_CANNOT_READ_MANIFEST_FILE.get(String.valueOf(e.getMessage()));
- throw new InitializationException(msg, e);
+ throw new ConfigException(msg, e);
}
// Break out when the end of the manifest is reached.
@@ -650,7 +650,7 @@
} catch (Exception e) {
LocalizableMessage msg =
ERR_CLASS_LOADER_CANNOT_LOAD_CLASS.get(className, String.valueOf(e.getMessage()));
- throw new InitializationException(msg, e);
+ throw new ConfigException(msg, e);
}
if (AbstractManagedObjectDefinition.class.isAssignableFrom(theClass)) {
// We need to instantiate it using its getInstance() static
@@ -662,7 +662,7 @@
LocalizableMessage msg =
ERR_CLASS_LOADER_CANNOT_FIND_GET_INSTANCE_METHOD.get(className,
String.valueOf(e.getMessage()));
- throw new InitializationException(msg, e);
+ throw new ConfigException(msg, e);
}
// Get the definition instance.
@@ -673,7 +673,7 @@
LocalizableMessage msg =
ERR_CLASS_LOADER_CANNOT_INVOKE_GET_INSTANCE_METHOD.get(className,
String.valueOf(e.getMessage()));
- throw new InitializationException(msg, e);
+ throw new ConfigException(msg, e);
}
definitions.add(d);
}
@@ -687,7 +687,7 @@
LocalizableMessage msg =
ERR_CLASS_LOADER_CANNOT_INITIALIZE_DEFN.get(d.getName(), d.getClass().getName(),
String.valueOf(e.getMessage()));
- throw new InitializationException(msg, e);
+ throw new ConfigException(msg, e);
}
}
}
@@ -698,10 +698,10 @@
* @param jar
* The name of the Jar file to load.
* @return Returns the loaded Jar file.
- * @throws InitializationException
+ * @throws ConfigException
* If the Jar file could not be loaded.
*/
- private JarFile loadJarFile(File jar) throws InitializationException {
+ private JarFile loadJarFile(File jar) throws ConfigException {
JarFile jarFile;
try {
@@ -713,7 +713,7 @@
LocalizableMessage message =
ERR_ADMIN_CANNOT_OPEN_JAR_FILE.get(jar.getName(), jar.getParent(),
stackTraceToSingleLineString(e, true));
- throw new InitializationException(message);
+ throw new ConfigException(message);
}
return jarFile;
}
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/server/ConfigException.java b/opendj-config/src/main/java/org/forgerock/opendj/config/server/ConfigException.java
index 55470df..cb7072a 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/server/ConfigException.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/server/ConfigException.java
@@ -33,9 +33,7 @@
* configuration.
*/
public final class ConfigException extends Exception implements LocalizableException {
-
private static final long serialVersionUID = -540463620272921157L;
-
private final LocalizableMessage message;
/**
diff --git a/opendj-config/src/main/java/org/opends/server/authorization/dseecompat/Aci.java b/opendj-config/src/main/java/org/opends/server/authorization/dseecompat/Aci.java
index 712de07..9906a7f 100644
--- a/opendj-config/src/main/java/org/opends/server/authorization/dseecompat/Aci.java
+++ b/opendj-config/src/main/java/org/opends/server/authorization/dseecompat/Aci.java
@@ -26,6 +26,7 @@
*/
package org.opends.server.authorization.dseecompat;
+import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
@@ -48,10 +49,10 @@
* @param dn
* DN of the ACI entry.
* @return Returns a decoded ACI representing the string argument.
- * @throws AciException
+ * @throws LocalizedIllegalArgumentException
* If the parsing of the ACI string fails.
*/
- public static Aci decode(ByteString byteString, DN dn) throws AciException {
+ public static Aci decode(ByteString byteString, DN dn) {
throw new RuntimeException("This class is not implemented");
}
}
diff --git a/opendj-config/src/main/java/org/opends/server/authorization/dseecompat/AciException.java b/opendj-config/src/main/java/org/opends/server/authorization/dseecompat/AciException.java
deleted file mode 100644
index e702826..0000000
--- a/opendj-config/src/main/java/org/opends/server/authorization/dseecompat/AciException.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2008 Sun Microsystems, Inc.
- */
-package org.opends.server.authorization.dseecompat;
-
-import org.forgerock.i18n.LocalizableMessage;
-import org.opends.server.types.IdentifiedException;
-
-/**
- * The AciException class defines an exception that may be thrown either during
- * ACI syntax verification of an "aci" attribute type value or during evaluation
- * of an LDAP operation using a set of applicable ACIs.
- */
-public class AciException extends IdentifiedException {
- /**
- * The serial version identifier required to satisfy the compiler because
- * this class extends <CODE>java.lang.Exception</CODE>, which implements the
- * <CODE>java.io.Serializable</CODE> interface. This value was generated
- * using the <CODE>serialver</CODE> command-line utility included with the
- * Java SDK.
- */
- private static final long serialVersionUID = -2763328522960628853L;
-
- /**
- * Constructs a new exception with <code>null</code> as its detail message.
- * The cause is not initialized. Used to break out of a recursive bind rule
- * decode and not print duplicate messages.
- */
- public AciException() {
- super();
- }
-
- /**
- * Creates a new ACI exception with the provided message.
- *
- * @param message
- * The message to use for this ACI exception.
- */
- public AciException(LocalizableMessage message) {
- super(message);
- }
-
- /**
- * Creates a new ACI exception with the provided message and root cause.
- *
- * @param message
- * The message that explains the problem that occurred.
- * @param cause
- * The exception that was caught to trigger this exception.
- */
- public AciException(LocalizableMessage message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/opendj-config/src/main/java/org/opends/server/core/DirectoryServer.java b/opendj-config/src/main/java/org/opends/server/core/DirectoryServer.java
index 36ef34e..a7b548a 100644
--- a/opendj-config/src/main/java/org/opends/server/core/DirectoryServer.java
+++ b/opendj-config/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -26,7 +26,6 @@
package org.opends.server.core;
import org.forgerock.opendj.ldap.schema.AttributeType;
-import org.forgerock.opendj.ldap.schema.ObjectClass;
import org.forgerock.opendj.ldap.schema.Schema;
import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException;
@@ -97,34 +96,4 @@
throw new RuntimeException("Not implemented");
}
- /**
- * Retrieves the objectclass for the provided lowercase name or OID.
- *
- * @param lowerName
- * The lowercase name or OID for the objectclass to retrieve.
- * @return The requested objectclass, or <CODE>null</CODE> if there is no
- * such objectclass defined in the server schema.
- */
- public static ObjectClass getObjectClass(String lowerName) {
- try {
- return Schema.getDefaultSchema().getObjectClass(lowerName);
- } catch (UnknownSchemaElementException e) {
- return null;
- }
- }
-
- /**
- * Causes the Directory Server to construct a new objectclass definition
- * with the provided name and with no required or allowed attributes. This
- * should only be used if there is no objectclass for the specified name. It
- * will not register the created objectclass with the Directory Server.
- *
- * @param name
- * The name to use for the objectclass, as provided by the user.
- * @return The constructed objectclass definition.
- */
- public static ObjectClass getDefaultObjectClass(String name) {
- return getObjectClass(name);
- }
-
}
diff --git a/opendj-config/src/main/java/org/opends/server/types/DirectoryException.java b/opendj-config/src/main/java/org/opends/server/types/DirectoryException.java
deleted file mode 100644
index 8b37026..0000000
--- a/opendj-config/src/main/java/org/opends/server/types/DirectoryException.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2013 ForgeRock AS
- */
-package org.opends.server.types;
-
-import java.util.List;
-
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.DN;
-import org.forgerock.opendj.ldap.ResultCode;
-
-/**
- * This class defines an exception that may be thrown if a problem occurs in the
- * Directory Server.
- */
-public final class DirectoryException extends IdentifiedException {
- /**
- * The serial version identifier required to satisfy the compiler because
- * this class extends <CODE>java.lang.Exception</CODE>, which implements the
- * <CODE>java.io.Serializable</CODE> interface. This value was generated
- * using the <CODE>serialver</CODE> command-line utility included with the
- * Java SDK.
- */
- private static final long serialVersionUID = 2615453139798417203L;
-
- /** The matched DN returned to the client for this directory exception. */
- private final DN matchedDN;
-
- /** The set of referral URLs for this directory exception. */
- private final List<String> referralURLs;
-
- /**
- * The result code returned to the client for this directory exception.
- * Note: for security considerations (information leak) this result code
- * might not be the underlying reason why the directory server refused to
- * execute the operation.
- *
- * @see #maskedResultCode for the underlying reason why the directory server
- * refused to execute the operation
- */
- private final ResultCode resultCode;
-
- /**
- * If set, this is the real message for this directory exception that cannot
- * be returned to the client, but will be logged.
- *
- * @see #getMessage() for the message returned to the client
- */
- private LocalizableMessage maskedMessage;
-
- /**
- * If set, this is the real result code for this directory exception that
- * cannot be returned to the client, but will be logged.
- *
- * @see #resultCode for the reason code returned to the client
- */
- private ResultCode maskedResultCode;
-
- /**
- * Creates a new directory exception with the provided information.
- *
- * @param resultCode
- * The result code for this directory exception.
- * @param errorMessage
- * The error message for this directory exception.
- */
- public DirectoryException(ResultCode resultCode, LocalizableMessage errorMessage) {
- super(errorMessage);
-
- this.resultCode = resultCode;
- this.matchedDN = null;
- this.referralURLs = null;
- }
-
- /**
- * Creates a new directory exception with the provided information.
- *
- * @param resultCode
- * The result code for this directory exception.
- * @param errorMessage
- * The error message for this directory exception.
- * @param cause
- * The exception that was caught to trigger this directory
- * exception.
- */
- public DirectoryException(ResultCode resultCode, LocalizableMessage errorMessage, Throwable cause) {
- super(errorMessage, cause);
-
- this.resultCode = resultCode;
- this.matchedDN = null;
- this.referralURLs = null;
- }
-
- /**
- * Creates a new directory exception with the provided information.
- *
- * @param resultCode
- * The result code for this directory exception.
- * @param cause
- * The exception that was caught to trigger this directory
- * exception. The message of this exception will be set to that
- * of this parameter.
- */
- public DirectoryException(ResultCode resultCode, OpenDsException cause) {
- super(cause.getMessageObject(), cause);
-
- this.resultCode = resultCode;
- this.matchedDN = null;
- this.referralURLs = null;
- }
-
- /**
- * Creates a new directory exception with the provided information.
- *
- * @param resultCode
- * The result code for this directory exception.
- * @param errorMessage
- * The error message for this directory exception.
- * @param matchedDN
- * The matched DN for this directory exception.
- * @param cause
- * The exception that was caught to trigger this directory
- * exception.
- */
- public DirectoryException(ResultCode resultCode, LocalizableMessage errorMessage, DN matchedDN, Throwable cause) {
- super(errorMessage, cause);
-
- this.resultCode = resultCode;
- this.matchedDN = matchedDN;
- this.referralURLs = null;
- }
-
- /**
- * Creates a new directory exception with the provided information.
- *
- * @param resultCode
- * The result code for this directory exception.
- * @param errorMessage
- * The error message for this directory
- * @param matchedDN
- * The matched DN for this directory exception.
- * @param referralURLs
- * The set of referral URLs for this directory exception.
- * @param cause
- * The exception that was caught to trigger this directory
- * exception.
- */
- public DirectoryException(ResultCode resultCode, LocalizableMessage errorMessage, DN matchedDN,
- List<String> referralURLs, Throwable cause) {
- super(errorMessage, cause);
-
- this.resultCode = resultCode;
- this.matchedDN = matchedDN;
- this.referralURLs = referralURLs;
- }
-
- /**
- * Retrieves the result code for this directory exception.
- *
- * @return The result code for this directory exception.
- */
- public ResultCode getResultCode() {
- return resultCode;
- }
-
- /**
- * Retrieves the matched DN for this directory exception.
- *
- * @return The matched DN for this directory exception, or <CODE>null</CODE>
- * if there is none.
- */
- public DN getMatchedDN() {
- return matchedDN;
- }
-
- /**
- * Retrieves the set of referral URLs for this directory exception.
- *
- * @return The set of referral URLs for this directory exception, or
- * <CODE>null</CODE> if there are none.
- */
- public List<String> getReferralURLs() {
- return referralURLs;
- }
-
- /**
- * Returns the real, masked message for this directory exception that cannot
- * be returned to the client, but will be logged.
- *
- * @return the real, masked message
- * @see #getMessage() for the message returned to the client
- */
- public LocalizableMessage getMaskedMessage() {
- return maskedMessage;
- }
-
- /**
- * Returns the real result code for this directory exception that cannot be
- * returned to the client, but will be logged.
- *
- * @return the real, masked result code
- * @see #getResultCode() for the result code returned to the client
- */
- public ResultCode getMaskedResultCode() {
- return maskedResultCode;
- }
-
- /**
- * Sets the real message for this directory exception that cannot be
- * returned to the client, but will be logged.
- *
- * @param maskedMessage
- * the real, masked message to set
- */
- public void setMaskedMessage(LocalizableMessage maskedMessage) {
- this.maskedMessage = maskedMessage;
- }
-
- /**
- * Sets the real result code for this directory exception that cannot be
- * returned to the client, but will be logged.
- *
- * @param maskedResultCode
- * the real, masked result code to set
- */
- public void setMaskedResultCode(ResultCode maskedResultCode) {
- this.maskedResultCode = maskedResultCode;
- }
-}
diff --git a/opendj-config/src/main/java/org/opends/server/types/IdentifiedException.java b/opendj-config/src/main/java/org/opends/server/types/IdentifiedException.java
deleted file mode 100644
index 4e643ca..0000000
--- a/opendj-config/src/main/java/org/opends/server/types/IdentifiedException.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2008 Sun Microsystems, Inc.
- */
-package org.opends.server.types;
-
-import org.forgerock.i18n.LocalizableMessage;
-
-/**
- * This class defines a base exception that should be extended by any exception
- * that exposes a unique identifier for the associated message.
- */
-public abstract class IdentifiedException extends OpenDsException {
- /**
- * Generated serialization ID.
- */
- private static final long serialVersionUID = 7071843225564003122L;
-
- /**
- * Creates a new identified exception.
- */
- protected IdentifiedException() {
- super();
- }
-
- /**
- * Creates a new identified exception with the provided information.
- *
- * @param message
- * The message that explains the problem that occurred.
- */
- protected IdentifiedException(LocalizableMessage message) {
- super(message);
- }
-
- /**
- * Creates a new identified exception with the provided information.
- *
- * @param cause
- * The underlying cause that triggered this exception.
- */
- protected IdentifiedException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Creates a new identified exception with the provided information.
- *
- * @param message
- * The message that explains the problem that occurred.
- * @param cause
- * The underlying cause that triggered this exception.
- */
- protected IdentifiedException(LocalizableMessage message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/opendj-config/src/main/java/org/opends/server/types/InitializationException.java b/opendj-config/src/main/java/org/opends/server/types/InitializationException.java
deleted file mode 100644
index be223be..0000000
--- a/opendj-config/src/main/java/org/opends/server/types/InitializationException.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- */
-package org.opends.server.types;
-
-import org.forgerock.i18n.LocalizableMessage;
-
-/**
- * This class defines an exception that may be thrown if a problem occurs while
- * trying to initialize a Directory Server component.
- */
-public final class InitializationException extends IdentifiedException {
- /**
- * The serial version identifier required to satisfy the compiler because
- * this class extends <CODE>java.lang.Exception</CODE>, which implements the
- * <CODE>java.io.Serializable</CODE> interface. This value was generated
- * using the <CODE>serialver</CODE> command-line utility included with the
- * Java SDK.
- */
- private static final long serialVersionUID = -6121147544833914730L;
-
- /**
- * Creates a new initialization exception with the provided message.
- *
- * @param message
- * The message that explains the problem that occurred.
- */
- public InitializationException(LocalizableMessage message) {
- super(message);
- }
-
- /**
- * Creates a new initialization exception with the provided message and root
- * cause.
- *
- * @param message
- * The message that explains the problem that occurred.
- * @param cause
- * The exception that was caught to trigger this exception.
- */
- public InitializationException(LocalizableMessage message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/opendj-config/src/main/java/org/opends/server/types/LDAPException.java b/opendj-config/src/main/java/org/opends/server/types/LDAPException.java
deleted file mode 100644
index 551071b..0000000
--- a/opendj-config/src/main/java/org/opends/server/types/LDAPException.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- */
-package org.opends.server.types;
-
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.DN;
-
-/**
- * This class defines an exception that may be thrown if a problem occurs while
- * interacting with an LDAP protocol element.
- */
-public final class LDAPException extends IdentifiedException {
- /**
- * The serial version identifier required to satisfy the compiler because
- * this class extends {@code java.lang.Exception}, which implements the
- * {@code java.io.Serializable} interface. This value was generated using
- * the {@code serialver} command-line utility included with the Java SDK.
- */
- private static final long serialVersionUID = -7273984376022613884L;
-
- // The matched DN associated with this LDAP exception.
- private final DN matchedDN;
-
- // The LDAP result code associated with this exception.
- private final int resultCode;
-
- // The server-provided error message for this LDAP exception.
- private final LocalizableMessage errorMessage;
-
- /**
- * Creates a new LDAP exception with the provided message.
- *
- * @param resultCode
- * The LDAP result code associated with this exception.
- * @param message
- * The message that explains the problem that occurred.
- */
- public LDAPException(int resultCode, LocalizableMessage message) {
- super(message);
-
- this.resultCode = resultCode;
-
- errorMessage = null;
- matchedDN = null;
- }
-
- /**
- * Creates a new LDAP exception with the provided message.
- *
- * @param resultCode
- * The LDAP result code associated with this exception.
- * @param errorMessage
- * The server-provided error message.
- * @param message
- * The message that explains the problem that occurred.
- */
- public LDAPException(int resultCode, LocalizableMessage errorMessage, LocalizableMessage message) {
- super(message);
-
- this.resultCode = resultCode;
- this.errorMessage = errorMessage;
-
- matchedDN = null;
- }
-
- /**
- * Creates a new LDAP exception with the provided message and root cause.
- *
- * @param resultCode
- * The LDAP result code associated with this exception.
- * @param message
- * The message that explains the problem that occurred.
- * @param cause
- * The exception that was caught to trigger this exception.
- */
- public LDAPException(int resultCode, LocalizableMessage message, Throwable cause) {
- super(message, cause);
-
- this.resultCode = resultCode;
-
- errorMessage = null;
- matchedDN = null;
- }
-
- /**
- * Creates a new LDAP exception with the provided message and root cause.
- *
- * @param resultCode
- * The LDAP result code associated with this exception.
- * @param errorMessage
- * The server-provided error message.
- * @param message
- * The message that explains the problem that occurred.
- * @param cause
- * The exception that was caught to trigger this exception.
- */
- public LDAPException(int resultCode, LocalizableMessage errorMessage, LocalizableMessage message, Throwable cause) {
- super(message, cause);
-
- this.resultCode = resultCode;
- this.errorMessage = errorMessage;
-
- matchedDN = null;
- }
-
- /**
- * Creates a new LDAP exception with the provided message and root cause.
- *
- * @param resultCode
- * The LDAP result code associated with this exception.
- * @param errorMessage
- * The server-provided error message.
- * @param message
- * The message that explains the problem that occurred.
- * @param matchedDN
- * The matched DN returned by the server.
- * @param cause
- * The exception that was caught to trigger this exception.
- */
- public LDAPException(int resultCode, LocalizableMessage errorMessage, LocalizableMessage message, DN matchedDN,
- Throwable cause) {
- super(message, cause);
-
- this.resultCode = resultCode;
- this.errorMessage = errorMessage;
- this.matchedDN = matchedDN;
- }
-
- /**
- * Retrieves the LDAP result code associated with this exception.
- *
- * @return The LDAP result code associated with this exception.
- */
- public int getResultCode() {
- return resultCode;
- }
-
- /**
- * Retrieves the server-provided error message for this exception.
- *
- * @return The server-provided error message for this exception, or
- * {@code null} if none was given.
- */
- public LocalizableMessage getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Retrieves the matched DN for this exception.
- *
- * @return The matched DN for this exception, or {@code null} if there is
- * none.
- */
- public DN getMatchedDN() {
- return matchedDN;
- }
-}
diff --git a/opendj-config/src/main/java/org/opends/server/types/OpenDsException.java b/opendj-config/src/main/java/org/opends/server/types/OpenDsException.java
deleted file mode 100644
index e2b4779..0000000
--- a/opendj-config/src/main/java/org/opends/server/types/OpenDsException.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2008 Sun Microsystems, Inc.
- */
-package org.opends.server.types;
-
-import org.forgerock.i18n.LocalizableMessage;
-
-/**
- * This class defines a base exception for OpenDS exceptions.
- */
-public abstract class OpenDsException extends Exception {
-
- /**
- * Generated serialization ID.
- */
- private static final long serialVersionUID = 7310881401563732702L;
-
- /** LocalizableMessage that explains the problem. */
- LocalizableMessage message;
-
- /**
- * Creates a new identified exception.
- */
- protected OpenDsException() {
- super();
- }
-
- /**
- * Constructs a new instance from another <code>OpenDsException</code>. This
- * constructor sets the message to be that of <code>cause</code>.
- *
- * @param cause
- * exception whose message will be used for this exception's
- * message.
- */
- protected OpenDsException(OpenDsException cause) {
- this(null, cause);
- }
-
- /**
- * Creates a new identified exception with the provided information.
- *
- * @param message
- * The message that explains the problem that occurred.
- */
- protected OpenDsException(LocalizableMessage message) {
- this(message, null);
- }
-
- /**
- * Creates a new identified exception with the provided information.
- *
- * @param cause
- * The underlying cause that triggered this exception.
- */
- protected OpenDsException(Throwable cause) {
- this(null, cause);
- }
-
- /**
- * Creates a new identified exception with the provided information.
- *
- * @param message
- * The message that explains the problem that occurred.
- * @param cause
- * The underlying cause that triggered this exception.
- */
- protected OpenDsException(LocalizableMessage message, Throwable cause) {
- super(message != null ? message.toString() : cause != null ? cause.getMessage() : null, cause);
- if (message != null) {
- this.message = message;
- } else if (cause instanceof OpenDsException) {
- this.message = ((OpenDsException) cause).getMessageObject();
- }
- }
-
- /**
- * Returns the message that explains the problem that occurred.
- *
- * @return LocalizableMessage of the problem
- */
- public LocalizableMessage getMessageObject() {
- return this.message;
- }
-}
diff --git a/opendj-config/src/test/java/org/forgerock/opendj/config/DNPropertyDefinitionTest.java b/opendj-config/src/test/java/org/forgerock/opendj/config/DNPropertyDefinitionTest.java
index 3c50465..1481182 100644
--- a/opendj-config/src/test/java/org/forgerock/opendj/config/DNPropertyDefinitionTest.java
+++ b/opendj-config/src/test/java/org/forgerock/opendj/config/DNPropertyDefinitionTest.java
@@ -30,7 +30,6 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.server.config.meta.RootCfgDefn;
-import org.opends.server.types.DirectoryException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -46,7 +45,7 @@
@Test(dataProvider = "baseDN")
- public void testBuilderSetBaseDN(String baseDN) throws DirectoryException {
+ public void testBuilderSetBaseDN(String baseDN) {
DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition.createBuilder(RootCfgDefn.getInstance(),
"test-property");
localBuilder.setBaseDN(baseDN);
@@ -90,7 +89,7 @@
}
@Test(dataProvider = "legalValues")
- public void testValidateLegalValues(String baseDN, String valueToValidate) throws DirectoryException {
+ public void testValidateLegalValues(String baseDN, String valueToValidate) {
DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition.createBuilder(RootCfgDefn.getInstance(),
"test-property");
localBuilder.setBaseDN(baseDN);
@@ -99,7 +98,7 @@
}
@Test(dataProvider = "illegalValues", expectedExceptions = IllegalPropertyValueException.class)
- public void testValidateIllegalValues(String baseDN, String valueToValidate) throws DirectoryException {
+ public void testValidateIllegalValues(String baseDN, String valueToValidate) {
DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition.createBuilder(RootCfgDefn.getInstance(),
"test-property");
localBuilder.setBaseDN(baseDN);
--
Gitblit v1.10.0