From e538344449d345daa6e5ecb9b05ceba5427408e9 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Wed, 04 Dec 2013 14:13:59 +0000
Subject: [PATCH] OpenDJ 3 : config framework
---
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectDecodingException.java | 157 +++++++++++++++++++++++-----------------------------
1 files changed, 69 insertions(+), 88 deletions(-)
diff --git a/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectDecodingException.java b/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectDecodingException.java
index a2cc3cb..f8d7fba 100644
--- a/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectDecodingException.java
+++ b/opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectDecodingException.java
@@ -27,8 +27,6 @@
package org.opends.server.admin.server;
-
-
import static com.forgerock.opendj.ldap.AdminMessages.*;
import java.util.Collection;
@@ -42,107 +40,90 @@
import org.opends.server.admin.PropertyException;
import static com.forgerock.opendj.util.Validator.*;
-
-
/**
- * The requested server managed object was found but one or more of
- * its properties could not be decoded successfully.
+ * The requested server managed object was found but one or more of its
+ * properties could not be decoded successfully.
*/
public class ServerManagedObjectDecodingException extends DecodingException {
- /**
- * Version ID required by serializable classes.
- */
- private static final long serialVersionUID = 1598401431084729853L;
+ /**
+ * Version ID required by serializable classes.
+ */
+ private static final long serialVersionUID = 1598401431084729853L;
+ // Create the message.
+ private static LocalizableMessage createMessage(ServerManagedObject<?> partialManagedObject,
+ Collection<PropertyException> causes) {
+ ensureNotNull(causes);
+ ensureTrue(!causes.isEmpty(), "causes should nnot be empty");
+ ManagedObjectDefinition<?, ?> d = partialManagedObject.getManagedObjectDefinition();
+ if (causes.size() == 1) {
+ return ERR_MANAGED_OBJECT_DECODING_EXCEPTION_SINGLE.get(d.getUserFriendlyName(), causes.iterator().next()
+ .getLocalizableMessageObject());
+ } else {
+ LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
- // Create the message.
- private static LocalizableMessage createMessage(
- ServerManagedObject<?> partialManagedObject,
- Collection<PropertyException> causes) {
- ensureNotNull(causes);
- ensureTrue(!causes.isEmpty(), "causes should nnot be empty");
+ boolean isFirst = true;
+ for (PropertyException cause : causes) {
+ if (!isFirst) {
+ builder.append("; ");
+ }
+ builder.append(cause.getLocalizableMessageObject());
+ isFirst = false;
+ }
- ManagedObjectDefinition<?, ?> d = partialManagedObject
- .getManagedObjectDefinition();
- if (causes.size() == 1) {
- return ERR_MANAGED_OBJECT_DECODING_EXCEPTION_SINGLE.get(d
- .getUserFriendlyName(), causes.iterator().next().getMessageObject());
- } else {
- LocalizableMessageBuilder builder = new MessageBuilder();
-
- boolean isFirst = true;
- for (PropertyException cause : causes) {
- if (!isFirst) {
- builder.append("; ");
+ return ERR_MANAGED_OBJECT_DECODING_EXCEPTION_PLURAL.get(d.getUserFriendlyName(), builder.toMessage());
}
- builder.append(cause.getMessageObject());
- isFirst = false;
- }
-
- return ERR_MANAGED_OBJECT_DECODING_EXCEPTION_PLURAL.get(d
- .getUserFriendlyName(), builder.toMessage());
}
- }
- // The exception(s) that caused this decoding exception.
- private final Collection<PropertyException> causes;
+ // The exception(s) that caused this decoding exception.
+ private final Collection<PropertyException> causes;
- // The partially created server managed object.
- private final ServerManagedObject<?> partialManagedObject;
+ // The partially created server managed object.
+ private final ServerManagedObject<?> partialManagedObject;
+ /**
+ * Create a new property decoding exception.
+ *
+ * @param partialManagedObject
+ * The partially created server managed object containing
+ * properties which were successfully decoded and empty
+ * properties for those which were not (this may include empty
+ * mandatory properties).
+ * @param causes
+ * The exception(s) that caused this decoding exception.
+ */
+ public ServerManagedObjectDecodingException(ServerManagedObject<?> partialManagedObject,
+ Collection<PropertyException> causes) {
+ super(createMessage(partialManagedObject, causes));
+ this.partialManagedObject = partialManagedObject;
+ this.causes = Collections.unmodifiableList(new LinkedList<PropertyException>(causes));
+ }
- /**
- * Create a new property decoding exception.
- *
- * @param partialManagedObject
- * The partially created server managed object containing
- * properties which were successfully decoded and empty
- * properties for those which were not (this may include
- * empty mandatory properties).
- * @param causes
- * The exception(s) that caused this decoding exception.
- */
- public ServerManagedObjectDecodingException(
- ServerManagedObject<?> partialManagedObject,
- Collection<PropertyException> causes) {
- super(createMessage(partialManagedObject, causes));
+ /**
+ * Get an unmodifiable collection view of the causes of this exception.
+ *
+ * @return Returns an unmodifiable collection view of the causes of this
+ * exception.
+ */
+ public Collection<PropertyException> getCauses() {
+ return causes;
+ }
- this.partialManagedObject = partialManagedObject;
- this.causes = Collections
- .unmodifiableList(new LinkedList<PropertyException>(causes));
- }
-
-
-
- /**
- * Get an unmodifiable collection view of the causes of this
- * exception.
- *
- * @return Returns an unmodifiable collection view of the causes of
- * this exception.
- */
- public Collection<PropertyException> getCauses() {
- return causes;
- }
-
-
-
- /**
- * Get the partially created server managed object containing
- * properties which were successfully decoded and empty properties
- * for those which were not (this may include empty mandatory
- * properties).
- *
- * @return Returns the partially created server managed object
- * containing properties which were successfully decoded and
- * empty properties for those which were not (this may
- * include empty mandatory properties).
- */
- public ServerManagedObject<?> getPartialManagedObject() {
- return partialManagedObject;
- }
+ /**
+ * Get the partially created server managed object containing properties
+ * which were successfully decoded and empty properties for those which were
+ * not (this may include empty mandatory properties).
+ *
+ * @return Returns the partially created server managed object containing
+ * properties which were successfully decoded and empty properties
+ * for those which were not (this may include empty mandatory
+ * properties).
+ */
+ public ServerManagedObject<?> getPartialManagedObject() {
+ return partialManagedObject;
+ }
}
--
Gitblit v1.10.0