mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
18.12.2014 3eca18748064ed39f967201ecfa07cb58907fd90
Simplify config framework exception hierarchy by removing AdminRuntimeException + additional minor cleanup.
1 files deleted
3 files modified
119 ■■■■ changed files
opendj-config/src/main/java/org/forgerock/opendj/config/AdminRuntimeException.java 78 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/PropertyException.java 33 ●●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/client/ManagedObjectDecodingException.java 4 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagedObjectDecodingException.java 4 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/AdminRuntimeException.java
File was deleted
opendj-config/src/main/java/org/forgerock/opendj/config/PropertyException.java
@@ -33,13 +33,14 @@
import static com.forgerock.opendj.ldap.AdminMessages.ERR_PROPERTY_IS_SINGLE_VALUED_EXCEPTION;
import static com.forgerock.opendj.ldap.AdminMessages.ERR_UNKNOWN_PROPERTY_DEFINITION_EXCEPTION;
import org.forgerock.i18n.LocalizableException;
import org.forgerock.i18n.LocalizableMessage;
/**
 * Exceptions thrown as a result of errors that occurred when decoding and
 * modifying property values.
 */
public final class PropertyException extends AdminRuntimeException {
public final class PropertyException extends RuntimeException implements LocalizableException {
    /**
     * Version ID required by serializable classes.
@@ -94,7 +95,7 @@
    }
    /**
     * Create a new property is mandatory exception.
     * Creates a new property is mandatory exception.
     *
     * @param pd
     *            The property definition.
@@ -105,7 +106,7 @@
    }
    /**
     * Create a new property is read-only exception.
     * Creates a new property is read-only exception.
     *
     * @param pd
     *            The property definition.
@@ -116,7 +117,7 @@
    }
    /**
     * Create a new property is single valued exception.
     * Creates a new property is single valued exception.
     *
     * @param pd
     *            The property definition.
@@ -149,27 +150,39 @@
                builder.getUsage(pd));
    }
    // LocalizableMessage that explains the problem.
    private final LocalizableMessage message;
    // The property definition associated with the property that caused
    // the exception.
    private final PropertyDefinition<?> pd;
    private PropertyException(final PropertyDefinition<?> pd, final LocalizableMessage message) {
        super(message);
        super(message.toString());
        this.message = message;
        this.pd = pd;
    }
    private PropertyException(final PropertyDefinition<?> pd, final LocalizableMessage message,
            final Throwable cause) {
        super(message, cause);
        super(message.toString(), cause);
        this.message = message;
        this.pd = pd;
    }
    /**
     * Get the property definition associated with the property that caused the
     * exception.
     * {@inheritDoc}
     */
    public LocalizableMessage getMessageObject() {
        return message;
    }
    /**
     * Returns the property definition associated with the property that caused
     * the exception.
     *
     * @return Returns the property definition associated with the property that
     *         caused the exception.
     * @return The property definition associated with the property that caused
     *         the exception.
     */
    public final PropertyDefinition<?> getPropertyDefinition() {
        return pd;
opendj-config/src/main/java/org/forgerock/opendj/config/client/ManagedObjectDecodingException.java
@@ -58,7 +58,7 @@
        ManagedObjectDefinition<?, ?> d = partialManagedObject.getManagedObjectDefinition();
        if (causes.size() == 1) {
            return ERR_MANAGED_OBJECT_DECODING_EXCEPTION_SINGLE.get(d.getUserFriendlyName(), causes.iterator().next()
                .getLocalizableMessageObject());
                .getMessageObject());
        } else {
            LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
@@ -67,7 +67,7 @@
                if (!isFirst) {
                    builder.append("; ");
                }
                builder.append(cause.getLocalizableMessageObject());
                builder.append(cause.getMessageObject());
                isFirst = false;
            }
opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagedObjectDecodingException.java
@@ -59,7 +59,7 @@
        ManagedObjectDefinition<?, ?> d = partialManagedObject.getManagedObjectDefinition();
        if (causes.size() == 1) {
            return ERR_MANAGED_OBJECT_DECODING_EXCEPTION_SINGLE.get(d.getUserFriendlyName(), causes.iterator().next()
                    .getLocalizableMessageObject());
                    .getMessageObject());
        } else {
            LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
@@ -68,7 +68,7 @@
                if (!isFirst) {
                    builder.append("; ");
                }
                builder.append(cause.getLocalizableMessageObject());
                builder.append(cause.getMessageObject());
                isFirst = false;
            }