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

Nicolas Capponi
02.33.2014 2737523b4f973f89fd2d8861fa6dcbc1e46e3154
opendj-admin/src/main/java/org/opends/server/admin/client/IllegalManagedObjectNameException.java
@@ -32,6 +32,7 @@
import org.opends.server.admin.OperationsException;
import org.opends.server.admin.PropertyDefinition;
import org.opends.server.admin.PropertyDefinitionUsageBuilder;
import org.opends.server.admin.PropertyDefinitionsOptions;
/**
 * Thrown when an attempt is made to create a new managed object with an illegal
@@ -50,15 +51,15 @@
    private static final long serialVersionUID = 7491748228684293291L;
    /** Create the message. */
    // @Checkstyle:ignore
    private static LocalizableMessage createMessage(String illegalName, PropertyDefinition<?> namingPropertyDefinition) {
    private static LocalizableMessage createMessage(String illegalName, PropertyDefinition<?> namingPropertyDefinition,
        PropertyDefinitionsOptions options) {
        if (illegalName.length() == 0) {
            return ERR_ILLEGAL_MANAGED_OBJECT_NAME_EXCEPTION_EMPTY.get();
        } else if (illegalName.trim().length() == 0) {
            return ERR_ILLEGAL_MANAGED_OBJECT_NAME_EXCEPTION_BLANK.get();
        } else if (namingPropertyDefinition != null) {
            try {
                namingPropertyDefinition.decodeValue(illegalName);
                namingPropertyDefinition.decodeValue(illegalName, options);
            } catch (IllegalPropertyValueStringException e) {
                PropertyDefinitionUsageBuilder builder = new PropertyDefinitionUsageBuilder(true);
                return ERR_ILLEGAL_MANAGED_OBJECT_NAME_EXCEPTION_SYNTAX.get(illegalName,
@@ -82,7 +83,7 @@
     *            The illegal managed object name.
     */
    public IllegalManagedObjectNameException(String illegalName) {
        this(illegalName, null);
        this(illegalName, null, null);
    }
    /**
@@ -92,9 +93,12 @@
     *            The illegal managed object name.
     * @param namingPropertyDefinition
     *            The naming property definition.
     * @param options
     *            Options to decode property definition values.
     */
    public IllegalManagedObjectNameException(String illegalName, PropertyDefinition<?> namingPropertyDefinition) {
        super(createMessage(illegalName, namingPropertyDefinition));
    public IllegalManagedObjectNameException(String illegalName, PropertyDefinition<?> namingPropertyDefinition,
        PropertyDefinitionsOptions options) {
        super(createMessage(illegalName, namingPropertyDefinition, options));
        this.illegalName = illegalName;
        this.namingPropertyDefinition = namingPropertyDefinition;