From 9314d4add5ffbc40b21347539a0e503964dae207 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Sat, 18 Jan 2014 00:58:42 +0000
Subject: [PATCH] Simplify config framework exception hierarchy by removing and pulling up the following exceptions:
---
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgDefn.java | 6
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/AttributeTypePropertyDefinition.java | 6
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagementContext.java | 47 +--
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/server/AggregationServerTest.java | 9
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/PropertySet.java | 14
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/DNPropertyDefinition.java | 6
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/DurationPropertyDefinition.java | 14
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/StringPropertyDefinition.java | 6
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IPAddressMaskPropertyDefinition.java | 2
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/Driver.java | 46 +--
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/DNPropertyDefinitionTest.java | 4
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/EnumPropertyDefinitionTest.java | 2
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgClient.java | 28 +-
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/ClassPropertyDefinition.java | 14
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/SizePropertyDefinition.java | 12
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/MissingMandatoryPropertiesException.java | 16
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgDefn.java | 2
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/IllegalManagedObjectNameException.java | 4
opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/property-types.xsl | 16
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgClient.java | 28 +-
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/BooleanPropertyDefinitionTest.java | 2
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/BooleanPropertyDefinition.java | 2
opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/clientMO.xsl | 18
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/DurationPropertyDefinitionTest.java | 10
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyDefinitionVisitor.java | 6
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyValueVisitor.java | 6
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/client/ldap/AggregationClientTest.java | 8
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyDefinition.java | 8
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/IntegerPropertyDefinitionTest.java | 8
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/ManagedObject.java | 27 +-
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/AbstractManagedObject.java | 27 +-
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/SizePropertyDefinitionTest.java | 8
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/StringPropertyDefinitionTest.java | 4
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/Reference.java | 2
/dev/null | 65 -----
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/ClassPropertyDefinitionTest.java | 2
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IntegerPropertyDefinition.java | 12
opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/metaMO.xsl | 12
opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/AttributeTypePropertyDefinitionTest.java | 2
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/AggregationPropertyDefinition.java | 8
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java | 20 -
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/ACIPropertyDefinition.java | 2
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/EnumPropertyDefinition.java | 2
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyException.java | 137 +++++++++-
opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IPAddressPropertyDefinition.java | 2
45 files changed, 342 insertions(+), 340 deletions(-)
diff --git a/opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/clientMO.xsl b/opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/clientMO.xsl
index c059c11..ee76e5f 100644
--- a/opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/clientMO.xsl
+++ b/opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/clientMO.xsl
@@ -181,14 +181,14 @@
' The definition of the ', $ufn,' to be created.
',
'@param exceptions
',
' An optional collection in which to place any ',
- '{@link DefaultBehaviorException}s that occurred whilst ',
+ '{@link PropertyException}s that occurred whilst ',
'attempting to determine the default values of the ', $ufn,
'. This argument can be <code>null<code>.
',
'@return Returns a new ', $ufn,' configuration instance.
')" />
</xsl:call-template>
<xsl:value-of
select="concat(' <C extends ', $java-class-name,'CfgClient> C create', $java-relation-name, '(
',
- ' ManagedObjectDefinition<C, ? extends ', $java-class-name,'Cfg> d, Collection<DefaultBehaviorException> exceptions);
')" />
+ ' ManagedObjectDefinition<C, ? extends ', $java-class-name,'Cfg> d, Collection<PropertyException> exceptions);
')" />
<xsl:text>
</xsl:text>
<xsl:text>
</xsl:text>
<xsl:text>
</xsl:text>
@@ -291,7 +291,7 @@
' The name of the new ', $ufn,'.
',
'@param exceptions
',
' An optional collection in which to place any ',
- '{@link DefaultBehaviorException}s that occurred whilst ',
+ '{@link PropertyException}s that occurred whilst ',
'attempting to determine the default values of the ', $ufn,
'. This argument can be <code>null<code>.
',
'@return Returns a new ', $ufn,' configuration instance.
',
@@ -300,7 +300,7 @@
</xsl:call-template>
<xsl:value-of
select="concat(' <C extends ', $java-class-name,'CfgClient> C create', $java-relation-name, '(
',
- ' ManagedObjectDefinition<C, ? extends ', $java-class-name,'Cfg> d, String name, Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException;
')" />
+ ' ManagedObjectDefinition<C, ? extends ', $java-class-name,'Cfg> d, String name, Collection<PropertyException> exceptions) throws IllegalManagedObjectNameException;
')" />
</xsl:when>
<xsl:when test="string(adm:one-to-many/@unique) = 'true'">
<xsl:call-template name="add-java-comment2">
@@ -319,14 +319,14 @@
' The definition of the ', $ufn,' to be created.
',
'@param exceptions
',
' An optional collection in which to place any ',
- '{@link DefaultBehaviorException}s that occurred whilst ',
+ '{@link PropertyException}s that occurred whilst ',
'attempting to determine the default values of the ', $ufn,
'. This argument can be <code>null<code>.
',
'@return Returns a new ', $ufn,' configuration instance.
')" />
</xsl:call-template>
<xsl:value-of
select="concat(' <C extends ', $java-class-name,'CfgClient> C create', $java-relation-name, '(
',
- ' ManagedObjectDefinition<C, ? extends ', $java-class-name,'Cfg> d, Collection<DefaultBehaviorException> exceptions);
')" />
+ ' ManagedObjectDefinition<C, ? extends ', $java-class-name,'Cfg> d, Collection<PropertyException> exceptions);
')" />
</xsl:when>
</xsl:choose>
<xsl:text>
</xsl:text>
@@ -386,12 +386,12 @@
<xsl:if
test="$this-local-properties[not(@monitoring='true')]">
<import>
- org.forgerock.opendj.config.IllegalPropertyValueException
+ org.forgerock.opendj.config.PropertyException
</import>
</xsl:if>
<xsl:if test="$this-local-properties[@read-only='true']">
<import>
- org.forgerock.opendj.config.PropertyIsReadOnlyException
+ org.forgerock.opendj.config.PropertyException
</import>
</xsl:if>
<xsl:if test="$this-local-relations">
@@ -428,7 +428,7 @@
test="$this-local-relations/adm:one-to-zero-or-one|$this-local-relations/adm:one-to-many">
<import>java.util.Collection</import>
<import>
- org.forgerock.opendj.config.DefaultBehaviorException
+ org.forgerock.opendj.config.PropertyException
</import>
<import>
org.forgerock.opendj.config.client.OperationRejectedException
diff --git a/opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/metaMO.xsl b/opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/metaMO.xsl
index 919d3e1..058b67c 100644
--- a/opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/metaMO.xsl
+++ b/opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/metaMO.xsl
@@ -1225,7 +1225,7 @@
' * {@inheritDoc}
',
' */
',
' public <M extends ', $java-class-name, 'CfgClient> M create', $java-relation-name, '(
',
- ' ManagedObjectDefinition<M, ? extends ', $java-class-name,'Cfg> d, Collection<DefaultBehaviorException> exceptions) {
',
+ ' ManagedObjectDefinition<M, ? extends ', $java-class-name,'Cfg> d, Collection<PropertyException> exceptions) {
',
' return impl.createChild(INSTANCE.get', $java-relation-name,'RelationDefinition(), d, exceptions).getConfiguration();
',
' }
')" />
<xsl:text>
</xsl:text>
@@ -1280,7 +1280,7 @@
' * {@inheritDoc}
',
' */
',
' public <M extends ', $java-class-name, 'CfgClient> M create', $java-relation-name, '(
',
- ' ManagedObjectDefinition<M, ? extends ', $java-class-name,'Cfg> d, String name, Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException {
',
+ ' ManagedObjectDefinition<M, ? extends ', $java-class-name,'Cfg> d, String name, Collection<PropertyException> exceptions) throws IllegalManagedObjectNameException {
',
' return impl.createChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), d, name, exceptions).getConfiguration();
',
' }
')" />
</xsl:when>
@@ -1291,7 +1291,7 @@
' * {@inheritDoc}
',
' */
',
' public <M extends ', $java-class-name, 'CfgClient> M create', $java-relation-name, '(
',
- ' ManagedObjectDefinition<M, ? extends ', $java-class-name,'Cfg> d, Collection<DefaultBehaviorException> exceptions) {
',
+ ' ManagedObjectDefinition<M, ? extends ', $java-class-name,'Cfg> d, Collection<PropertyException> exceptions) {
',
' return impl.createChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), d, exceptions).getConfiguration();
',
' }
')" />
</xsl:when>
@@ -1964,7 +1964,7 @@
</import>
</xsl:if>
<import>
- org.forgerock.opendj.config.DefaultBehaviorException
+ org.forgerock.opendj.config.PropertyException
</import>
<import>
org.forgerock.opendj.config.server.ConfigurationAddListener
@@ -1977,7 +1977,7 @@
<xsl:if test="$this-all-relations/adm:one-to-zero-or-one">
<import>java.util.Collection</import>
<import>
- org.forgerock.opendj.config.DefaultBehaviorException
+ org.forgerock.opendj.config.PropertyException
</import>
<import>
org.forgerock.opendj.config.server.ConfigurationAddListener
@@ -1996,7 +1996,7 @@
</xsl:if>
<xsl:if test="$this-all-properties[@read-only='true']">
<import>
- org.forgerock.opendj.config.PropertyIsReadOnlyException
+ org.forgerock.opendj.config.PropertyException
</import>
</xsl:if>
</xsl:otherwise>
diff --git a/opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/property-types.xsl b/opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/property-types.xsl
index 1e2fa57..8303e75 100644
--- a/opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/property-types.xsl
+++ b/opendj-sdk/opendj-config-maven-plugin/src/main/resources/config/stylesheets/property-types.xsl
@@ -519,12 +519,12 @@
<xsl:value-of
select="concat(' *
',
' * @param value The value of the "', $name, '" property.
',
- ' * @throws IllegalPropertyValueException
',
+ ' * @throws PropertyException
',
' * If the new value is invalid.
')" />
<xsl:if test="@read-only='true'">
<xsl:value-of
select="concat(
- ' * @throws PropertyIsReadOnlyException
',
+ ' * @throws PropertyException
',
' * If this ', $this-ufn, ' is not being initialized.
')" />
</xsl:if>
<xsl:value-of
@@ -546,12 +546,12 @@
<xsl:value-of
select="concat(' *
',
' * @param values The values of the "', $name, '" property.
',
- ' * @throws IllegalPropertyValueException
',
+ ' * @throws PropertyException
',
' * If one or more of the new values are invalid.
')" />
<xsl:if test="@read-only='true'">
<xsl:value-of
select="concat(
- ' * @throws PropertyIsReadOnlyException
',
+ ' * @throws PropertyException
',
' * If this ', $this-ufn, ' is not being initialized.
')" />
</xsl:if>
<xsl:value-of
@@ -562,9 +562,9 @@
<xsl:value-of select="'> values'" />
</xsl:otherwise>
</xsl:choose>
- <xsl:value-of select="') throws IllegalPropertyValueException'" />
+ <xsl:value-of select="') throws PropertyException'" />
<xsl:if test="@read-only='true'">
- <xsl:value-of select="', PropertyIsReadOnlyException'" />
+ <xsl:value-of select="', PropertyException'" />
</xsl:if>
<xsl:value-of select="';
'" />
</xsl:if>
@@ -606,7 +606,7 @@
<xsl:value-of select="' value)'" />
<xsl:if test="@read-only='true'">
<xsl:value-of
- select="' throws PropertyIsReadOnlyException'" />
+ select="' throws PropertyException'" />
</xsl:if>
<xsl:value-of
select="concat(' {
' ,
@@ -621,7 +621,7 @@
<xsl:value-of select="'> values)'" />
<xsl:if test="@read-only='true'">
<xsl:value-of
- select="' throws PropertyIsReadOnlyException'" />
+ select="' throws PropertyException'" />
</xsl:if>
<xsl:value-of
select="concat(' {
' ,
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/ACIPropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/ACIPropertyDefinition.java
index 044f8db..ff5b776 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/ACIPropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/ACIPropertyDefinition.java
@@ -102,7 +102,7 @@
return Aci.decode(ByteString.valueOf(value), DN.rootDN());
} catch (LocalizedIllegalArgumentException e) {
// TODO: it would be nice to throw the cause.
- throw new IllegalPropertyValueStringException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/AggregationPropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/AggregationPropertyDefinition.java
index b23167a..ee96379 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/AggregationPropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/AggregationPropertyDefinition.java
@@ -818,8 +818,8 @@
try {
validateValue(value, options);
return value;
- } catch (IllegalPropertyValueException e) {
- throw new IllegalPropertyValueStringException(this, value);
+ } catch (PropertyException e) {
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
@@ -952,7 +952,7 @@
Reference<C, S> reference = Reference.parseName(parentPath, relationDefinition, value);
return reference.getNormalizedName();
} catch (IllegalArgumentException e) {
- throw new IllegalPropertyValueException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
@@ -984,7 +984,7 @@
try {
Reference.parseName(parentPath, relationDefinition, value);
} catch (IllegalArgumentException e) {
- throw new IllegalPropertyValueException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/AttributeTypePropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/AttributeTypePropertyDefinition.java
index 4a0387e..40eb41e 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/AttributeTypePropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/AttributeTypePropertyDefinition.java
@@ -116,13 +116,13 @@
AttributeType type = DirectoryServer.getAttributeType(name, !options.checkSchemaForAttributes());
if (type == null) {
- throw new IllegalPropertyValueStringException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
} else {
try {
validateValue(type, options);
return type;
- } catch (IllegalPropertyValueException e) {
- throw new IllegalPropertyValueStringException(this, value);
+ } catch (PropertyException e) {
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/BooleanPropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/BooleanPropertyDefinition.java
index be12210..c00d1bc 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/BooleanPropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/BooleanPropertyDefinition.java
@@ -114,7 +114,7 @@
Boolean b = VALUE_MAP.get(nvalue);
if (b == null) {
- throw new IllegalPropertyValueStringException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
} else {
return b;
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/ClassPropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/ClassPropertyDefinition.java
index b9bc49e..f5f1284 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/ClassPropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/ClassPropertyDefinition.java
@@ -157,8 +157,8 @@
try {
validateValue(value, options);
- } catch (IllegalPropertyValueException e) {
- throw new IllegalPropertyValueStringException(this, value, e.getCause());
+ } catch (PropertyException e) {
+ throw PropertyException.illegalPropertyValueException(this, value, e.getCause());
}
return value;
@@ -187,7 +187,7 @@
* The class representing the requested type.
* @return Returns the named class cast to a subclass of the specified
* class.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If the named class was invalid, could not be loaded, or did
* not implement the required interfaces.
* @throws ClassCastException
@@ -240,7 +240,7 @@
private void validateClassName(String className) {
String nvalue = className.trim();
if (!nvalue.matches(CLASS_RE)) {
- throw new IllegalPropertyValueException(this, className);
+ throw PropertyException.illegalPropertyValueException(this, className);
}
}
@@ -253,7 +253,7 @@
for (String i : instanceOfInterfaces) {
Class<?> instanceOfClass = loadClassForValidation(className, i, initialize);
if (!instanceOfClass.isAssignableFrom(theClass)) {
- throw new IllegalPropertyValueException(this, className);
+ throw PropertyException.illegalPropertyValueException(this, className);
}
}
return theClass;
@@ -264,10 +264,10 @@
return loadClass(classToBeLoaded.trim(), initialize);
} catch (ClassNotFoundException e) {
// If the class cannot be loaded then it is an invalid value.
- throw new IllegalPropertyValueException(this, componentClassName, e);
+ throw PropertyException.illegalPropertyValueException(this, componentClassName, e);
} catch (LinkageError e) {
// If the class cannot be initialized then it is an invalid value.
- throw new IllegalPropertyValueException(this, componentClassName, e);
+ throw PropertyException.illegalPropertyValueException(this, componentClassName, e);
}
}
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/DNPropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/DNPropertyDefinition.java
index 670bc0c..39c76b5 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/DNPropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/DNPropertyDefinition.java
@@ -145,7 +145,7 @@
}
if (!parent.equals(baseDN)) {
- throw new IllegalPropertyValueException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
}
@@ -161,8 +161,8 @@
DN dn = DN.valueOf(value);
validateValue(dn, options);
return dn;
- } catch (IllegalPropertyValueException e) {
- throw new IllegalPropertyValueStringException(this, value);
+ } catch (PropertyException e) {
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/DefaultBehaviorException.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/DefaultBehaviorException.java
deleted file mode 100644
index 4537184..0000000
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/DefaultBehaviorException.java
+++ /dev/null
@@ -1,61 +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.forgerock.opendj.config;
-
-import static com.forgerock.opendj.ldap.AdminMessages.*;
-
-/**
- * This exception is thrown when a property's default values cannot be
- * determined. This can occur in the following situations:
- * <ul>
- * <li>the property has a well-defined set of default values but they are
- * invalid according to the property's syntax
- * <li>the property inherits its default values from another managed object but
- * they could not be retrieved, perhaps because of a communication problem.
- * </ul>
- */
-public class DefaultBehaviorException extends PropertyException {
-
- /**
- * Serialization ID.
- */
- private static final long serialVersionUID = -2542117466747573053L;
-
- /**
- * Create a new default behavior exception with a cause.
- *
- * @param pd
- * The property definition whose default values could not be
- * determined.
- * @param cause
- * The exception that prevented the default values from being
- * determined.
- */
- public DefaultBehaviorException(PropertyDefinition<?> pd, Throwable cause) {
- super(pd, ERR_DEFAULT_BEHAVIOR_PROPERTY_EXCEPTION.get(pd.getName()), cause);
- }
-}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/DurationPropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/DurationPropertyDefinition.java
index 868e81a..245bff8 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/DurationPropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/DurationPropertyDefinition.java
@@ -397,15 +397,15 @@
long nvalue = baseUnit.toMilliSeconds(value);
if (!allowUnlimited && nvalue < lowerLimit) {
- throw new IllegalPropertyValueException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
// unlimited allowed
} else if (nvalue >= 0 && nvalue < lowerLimit) {
- throw new IllegalPropertyValueException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
if ((upperLimit != null) && (nvalue > upperLimit)) {
- throw new IllegalPropertyValueException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
@@ -451,21 +451,21 @@
try {
ms = DurationUnit.parseValue(value);
} catch (NumberFormatException e) {
- throw new IllegalPropertyValueStringException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
// Check the unit is in range - values must not be more granular
// than the base unit.
if ((ms % baseUnit.getDuration()) != 0) {
- throw new IllegalPropertyValueStringException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
// Convert the value a long in the property's required unit.
Long i = (long) baseUnit.fromMilliSeconds(ms);
try {
validateValue(i, options);
- } catch (IllegalPropertyValueException e) {
- throw new IllegalPropertyValueStringException(this, value);
+ } catch (PropertyException e) {
+ throw PropertyException.illegalPropertyValueException(this, value);
}
return i;
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/EnumPropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/EnumPropertyDefinition.java
index 0a2fe71..07af2c7 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/EnumPropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/EnumPropertyDefinition.java
@@ -156,7 +156,7 @@
String nvalue = value.trim().toLowerCase();
E eValue = decodeMap.get(nvalue);
if (eValue == null) {
- throw new IllegalPropertyValueStringException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
} else {
return eValue;
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IPAddressMaskPropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IPAddressMaskPropertyDefinition.java
index 7bba194..46ee1c7 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IPAddressMaskPropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IPAddressMaskPropertyDefinition.java
@@ -103,7 +103,7 @@
return AddressMask.decode(value);
} catch (ConfigException e) {
// TODO: it would be nice to throw the cause.
- throw new IllegalPropertyValueStringException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IPAddressPropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IPAddressPropertyDefinition.java
index aa21481..4c7b551 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IPAddressPropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IPAddressPropertyDefinition.java
@@ -102,7 +102,7 @@
return InetAddress.getByName(value);
} catch (UnknownHostException e) {
// TODO: it would be nice to throw the cause.
- throw new IllegalPropertyValueStringException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IllegalPropertyValueException.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IllegalPropertyValueException.java
deleted file mode 100644
index e7c8c7e..0000000
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IllegalPropertyValueException.java
+++ /dev/null
@@ -1,90 +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.
- * Portions copyright 2013 ForgeRock AS.
- */
-package org.forgerock.opendj.config;
-
-import static com.forgerock.opendj.ldap.AdminMessages.*;
-
-import org.forgerock.i18n.LocalizableMessage;
-
-/**
- * Thrown to indicate that a property value was invalid according to its
- * associated property definition.
- */
-public class IllegalPropertyValueException extends PropertyException {
-
- /**
- * Serialization ID.
- */
- private static final long serialVersionUID = -3145632074909281823L;
-
- // The illegal property value.
- private final Object value;
-
- /**
- * Create a new illegal property value exception.
- *
- * @param pd
- * The property definition.
- * @param value
- * The illegal property value.
- */
- public IllegalPropertyValueException(PropertyDefinition<?> pd, Object value) {
- super(pd, createMessage(pd, value));
- this.value = value;
- }
-
- /**
- * Create a new illegal property value exception.
- *
- * @param pd
- * The property definition.
- * @param value
- * The illegal property value.
- * @param cause
- * The cause.
- */
- public IllegalPropertyValueException(PropertyDefinition<?> pd, Object value, Throwable cause) {
- super(pd, createMessage(pd, value), cause);
- this.value = value;
- }
-
- /**
- * Get the illegal property value that caused the exception.
- *
- * @return Returns the illegal property value.
- */
- public final Object getIllegalValue() {
- return value;
- }
-
- // Create the message.
- private static LocalizableMessage createMessage(PropertyDefinition<?> pd, Object value) {
- PropertyDefinitionUsageBuilder builder = new PropertyDefinitionUsageBuilder(true);
- return ERR_ILLEGAL_PROPERTY_VALUE_EXCEPTION.get(String.valueOf(value), pd.getName(), builder.getUsage(pd));
- }
-
-}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IllegalPropertyValueStringException.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IllegalPropertyValueStringException.java
deleted file mode 100644
index e6768ea..0000000
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IllegalPropertyValueStringException.java
+++ /dev/null
@@ -1,90 +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.
- * Portions copyright 2013 ForgeRock AS.
- */
-package org.forgerock.opendj.config;
-
-import org.forgerock.i18n.LocalizableMessage;
-
-import static com.forgerock.opendj.ldap.AdminMessages.*;
-
-/**
- * Thrown to indicate that a property value string was invalid according to its
- * associated property definition.
- */
-public class IllegalPropertyValueStringException extends PropertyException {
-
- /**
- * Serialization ID.
- */
- private static final long serialVersionUID = -3145632074909281823L;
-
- // The illegal property value string.
- private final String value;
-
- /**
- * Create a new illegal property value string exception.
- *
- * @param pd
- * The property definition.
- * @param value
- * The illegal property value string.
- */
- public IllegalPropertyValueStringException(PropertyDefinition<?> pd, String value) {
- super(pd, createMessage(pd, value));
- this.value = value;
- }
-
- /**
- * Create a new illegal property value string exception.
- *
- * @param pd
- * The property definition.
- * @param value
- * The illegal property value string.
- * @param cause
- * The cause.
- */
- public IllegalPropertyValueStringException(PropertyDefinition<?> pd, String value, Throwable cause) {
- super(pd, createMessage(pd, value), cause);
- this.value = value;
- }
-
- /**
- * Get the illegal property value string that caused the exception.
- *
- * @return Returns the illegal property value string.
- */
- public final String getIllegalValueString() {
- return value;
- }
-
- // Create the message.
- private static LocalizableMessage createMessage(PropertyDefinition<?> pd, String value) {
- PropertyDefinitionUsageBuilder builder = new PropertyDefinitionUsageBuilder(true);
- return ERR_ILLEGAL_PROPERTY_VALUE_STRING_EXCEPTION.get(value, pd.getName(), builder.getUsage(pd));
- }
-
-}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IntegerPropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IntegerPropertyDefinition.java
index a031f2e..9924207 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IntegerPropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/IntegerPropertyDefinition.java
@@ -233,15 +233,15 @@
Reject.ifNull(value);
if (!allowUnlimited && value < lowerLimit) {
- throw new IllegalPropertyValueException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
// unlimited allowed
} else if (value >= 0 && value < lowerLimit) {
- throw new IllegalPropertyValueException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
if ((upperLimit != null) && (value > upperLimit)) {
- throw new IllegalPropertyValueException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
@@ -279,13 +279,13 @@
try {
i = Integer.valueOf(value);
} catch (NumberFormatException e) {
- throw new IllegalPropertyValueStringException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
try {
validateValue(i, options);
- } catch (IllegalPropertyValueException e) {
- throw new IllegalPropertyValueStringException(this, value);
+ } catch (PropertyException e) {
+ throw PropertyException.illegalPropertyValueException(this, value);
}
return i;
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyDefinition.java
index 3d7c80f..e0d30fd 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyDefinition.java
@@ -321,7 +321,7 @@
* @param options
* Options to use when decoding value.
* @return Returns the decoded property value.
- * @throws IllegalPropertyValueStringException
+ * @throws PropertyException
* If the property value string is invalid.
*/
public abstract T decodeValue(String value, PropertyDefinitionsOptions options);
@@ -335,7 +335,7 @@
* @param value
* The property value (must not be <code>null</code>).
* @return Returns the encoded property string value.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If the property value is invalid.
*/
public String encodeValue(T value) {
@@ -520,7 +520,7 @@
* @param value
* The property value to be normalized.
* @return Returns the normalized property value.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If the property value is invalid.
*/
public String normalizeValue(T value) {
@@ -566,7 +566,7 @@
* The property value (must not be <code>null</code>).
* @param options
* Options to use when decoding value.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If the property value is invalid.
*/
public abstract void validateValue(T value, PropertyDefinitionsOptions options);
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyDefinitionVisitor.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyDefinitionVisitor.java
index 39f64dc..c16f0d6 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyDefinitionVisitor.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyDefinitionVisitor.java
@@ -242,7 +242,7 @@
* types.
* <p>
* The default implementation of this method throws an
- * {@link UnknownPropertyDefinitionException}. Sub-classes can override this
+ * {@link PropertyException}. Sub-classes can override this
* method with their own default behavior.
*
* @param <T>
@@ -252,11 +252,11 @@
* @param p
* A visitor specified parameter.
* @return Returns a visitor specified result.
- * @throws UnknownPropertyDefinitionException
+ * @throws PropertyException
* Visitor implementations may optionally throw this exception.
*/
public <T> R visitUnknown(PropertyDefinition<T> pd, P p) {
- throw new UnknownPropertyDefinitionException(pd, p);
+ throw PropertyException.unknownPropertyDefinitionException(pd, p);
}
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyException.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyException.java
index a193030..59ce8cf 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyException.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyException.java
@@ -26,49 +26,140 @@
package org.forgerock.opendj.config;
+import static com.forgerock.opendj.ldap.AdminMessages.ERR_DEFAULT_BEHAVIOR_PROPERTY_EXCEPTION;
+import static com.forgerock.opendj.ldap.AdminMessages.ERR_ILLEGAL_PROPERTY_VALUE_EXCEPTION;
+import static com.forgerock.opendj.ldap.AdminMessages.ERR_PROPERTY_IS_MANDATORY_EXCEPTION;
+import static com.forgerock.opendj.ldap.AdminMessages.ERR_PROPERTY_IS_READ_ONLY_EXCEPTION;
+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.LocalizableMessage;
/**
* Exceptions thrown as a result of errors that occurred when decoding and
* modifying property values.
*/
-public abstract class PropertyException extends AdminRuntimeException {
+public final class PropertyException extends AdminRuntimeException {
/**
* Version ID required by serializable classes.
*/
private static final long serialVersionUID = -8465109598081914482L;
+ /**
+ * Creates a new default behavior exception with a cause.
+ *
+ * @param pd
+ * The property definition whose default values could not be
+ * determined.
+ * @param cause
+ * The exception that prevented the default values from being
+ * determined.
+ * @return A new default behavior exception with a cause.
+ */
+ public static PropertyException defaultBehaviorException(final PropertyDefinition<?> pd,
+ final Throwable cause) {
+ return new PropertyException(pd, ERR_DEFAULT_BEHAVIOR_PROPERTY_EXCEPTION.get(pd.getName()),
+ cause);
+ }
+
+ /**
+ * Creates a new illegal property value exception.
+ *
+ * @param pd
+ * The property definition.
+ * @param value
+ * The illegal property value.
+ * @return A new illegal property value exception.
+ */
+ public static PropertyException illegalPropertyValueException(final PropertyDefinition<?> pd,
+ final Object value) {
+ return new PropertyException(pd, createMessage(pd, value));
+ }
+
+ /**
+ * Creates a new illegal property value exception.
+ *
+ * @param pd
+ * The property definition.
+ * @param value
+ * The illegal property value.
+ * @param cause
+ * The cause.
+ * @return A new illegal property value exception.
+ */
+ public static PropertyException illegalPropertyValueException(final PropertyDefinition<?> pd,
+ final Object value, final Throwable cause) {
+ return new PropertyException(pd, createMessage(pd, value), cause);
+ }
+
+ /**
+ * Create a new property is mandatory exception.
+ *
+ * @param pd
+ * The property definition.
+ * @return A new property is mandatory exception.
+ */
+ public static PropertyException propertyIsMandatoryException(final PropertyDefinition<?> pd) {
+ return new PropertyException(pd, ERR_PROPERTY_IS_MANDATORY_EXCEPTION.get(pd.getName()));
+ }
+
+ /**
+ * Create a new property is read-only exception.
+ *
+ * @param pd
+ * The property definition.
+ * @return A new property is read-only exception.
+ */
+ public static PropertyException propertyIsReadOnlyException(final PropertyDefinition<?> pd) {
+ return new PropertyException(pd, ERR_PROPERTY_IS_READ_ONLY_EXCEPTION.get(pd.getName()));
+ }
+
+ /**
+ * Create a new property is single valued exception.
+ *
+ * @param pd
+ * The property definition.
+ * @return A new property is single valued exception.
+ */
+ public static PropertyException propertyIsSingleValuedException(final PropertyDefinition<?> pd) {
+ return new PropertyException(pd, ERR_PROPERTY_IS_SINGLE_VALUED_EXCEPTION.get(pd.getName()));
+ }
+
+ /**
+ * Creates a new unknown property definition exception.
+ *
+ * @param pd
+ * The unknown property definition.
+ * @param p
+ * The visitor parameter if there was one.
+ * @return A new unknown property definition exception.
+ */
+ public static PropertyException unknownPropertyDefinitionException(
+ final PropertyDefinition<?> pd, final Object p) {
+ return new PropertyException(pd, ERR_UNKNOWN_PROPERTY_DEFINITION_EXCEPTION.get(
+ pd.getName(), pd.getClass().getName()));
+ }
+
+ // Create the message.
+ private static LocalizableMessage createMessage(final PropertyDefinition<?> pd,
+ final Object value) {
+ final PropertyDefinitionUsageBuilder builder = new PropertyDefinitionUsageBuilder(true);
+ return ERR_ILLEGAL_PROPERTY_VALUE_EXCEPTION.get(String.valueOf(value), pd.getName(),
+ builder.getUsage(pd));
+ }
+
// The property definition associated with the property that caused
// the exception.
private final PropertyDefinition<?> pd;
- /**
- * Creates property exception without a cause.
- *
- * @param pd
- * The property definition associated with the property that
- * caused the exception.
- * @param message
- * The message.
- */
- protected PropertyException(PropertyDefinition<?> pd, LocalizableMessage message) {
+ private PropertyException(final PropertyDefinition<?> pd, final LocalizableMessage message) {
super(message);
this.pd = pd;
}
- /**
- * Creates property exception with a cause.
- *
- * @param pd
- * The property definition associated with the property that
- * caused the exception.
- * @param message
- * The message.
- * @param cause
- * The cause.
- */
- protected PropertyException(PropertyDefinition<?> pd, LocalizableMessage message, Throwable cause) {
+ private PropertyException(final PropertyDefinition<?> pd, final LocalizableMessage message,
+ final Throwable cause) {
super(message, cause);
this.pd = pd;
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyIsMandatoryException.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyIsMandatoryException.java
deleted file mode 100644
index 067d988..0000000
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyIsMandatoryException.java
+++ /dev/null
@@ -1,50 +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.forgerock.opendj.config;
-
-import static com.forgerock.opendj.ldap.AdminMessages.*;
-
-/**
- * Thrown when an attempt is made to remove a mandatory property.
- */
-public class PropertyIsMandatoryException extends PropertyException {
-
- /**
- * Serialization ID.
- */
- private static final long serialVersionUID = 5328211711156565625L;
-
- /**
- * Create a new property is mandatory exception.
- *
- * @param pd
- * The property definition.
- */
- public PropertyIsMandatoryException(PropertyDefinition<?> pd) {
- super(pd, ERR_PROPERTY_IS_MANDATORY_EXCEPTION.get(pd.getName()));
- }
-
-}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyIsReadOnlyException.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyIsReadOnlyException.java
deleted file mode 100644
index 1522004..0000000
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyIsReadOnlyException.java
+++ /dev/null
@@ -1,50 +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.forgerock.opendj.config;
-
-import static com.forgerock.opendj.ldap.AdminMessages.*;
-
-/**
- * Thrown when an attempt is made to modify a read-only property.
- */
-public class PropertyIsReadOnlyException extends PropertyException {
-
- /**
- * Serialization ID.
- */
- private static final long serialVersionUID = 5315348044141024459L;
-
- /**
- * Create a new property is read-only exception.
- *
- * @param pd
- * The property definition.
- */
- public PropertyIsReadOnlyException(PropertyDefinition<?> pd) {
- super(pd, ERR_PROPERTY_IS_READ_ONLY_EXCEPTION.get(pd.getName()));
- }
-
-}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyIsSingleValuedException.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyIsSingleValuedException.java
deleted file mode 100644
index f79706d..0000000
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyIsSingleValuedException.java
+++ /dev/null
@@ -1,50 +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.forgerock.opendj.config;
-
-import static com.forgerock.opendj.ldap.AdminMessages.*;
-
-/**
- * Thrown when an attempt is made to add more than value to a single-valued
- * property.
- */
-public class PropertyIsSingleValuedException extends PropertyException {
-
- /**
- * Serialization ID.
- */
- private static final long serialVersionUID = -8056602690887917027L;
-
- /**
- * Create a new property is single valued exception.
- *
- * @param pd
- * The property definition.
- */
- public PropertyIsSingleValuedException(PropertyDefinition<?> pd) {
- super(pd, ERR_PROPERTY_IS_SINGLE_VALUED_EXCEPTION.get(pd.getName()));
- }
-}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyValueVisitor.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyValueVisitor.java
index fb94f94..fdf3af9 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyValueVisitor.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/PropertyValueVisitor.java
@@ -274,7 +274,7 @@
* can provide default behavior for unknown types of property.
* <p>
* The default implementation of this method throws an
- * {@link UnknownPropertyDefinitionException}. Sub-classes can override this
+ * {@link PropertyException}. Sub-classes can override this
* method with their own default behavior.
*
* @param <T>
@@ -286,11 +286,11 @@
* @param p
* A visitor specified parameter.
* @return Returns a visitor specified result.
- * @throws UnknownPropertyDefinitionException
+ * @throws PropertyException
* Visitor implementations may optionally throw this exception.
*/
public <T> R visitUnknown(PropertyDefinition<T> pd, T v, P p) {
- throw new UnknownPropertyDefinitionException(pd, p);
+ throw PropertyException.unknownPropertyDefinitionException(pd, p);
}
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/Reference.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/Reference.java
index fa8705e..4f29adb 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/Reference.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/Reference.java
@@ -192,7 +192,7 @@
// TODO : is it correct to have no validation ?
T tvalue = pd.decodeValue(name, PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
return pd.normalizeValue(tvalue);
- } catch (IllegalPropertyValueStringException e) {
+ } catch (PropertyException e) {
// Fall through to default normalization.
}
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/SizePropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/SizePropertyDefinition.java
index 0ac68cb..26d1cc7 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/SizePropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/SizePropertyDefinition.java
@@ -234,15 +234,15 @@
Reject.ifNull(value);
if (!allowUnlimited && value < lowerLimit) {
- throw new IllegalPropertyValueException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
// unlimited allowed
} else if (value >= 0 && value < lowerLimit) {
- throw new IllegalPropertyValueException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
if ((upperLimit != null) && (value > upperLimit)) {
- throw new IllegalPropertyValueException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
@@ -291,13 +291,13 @@
try {
i = SizeUnit.parseValue(value, SizeUnit.BYTES);
} catch (NumberFormatException e) {
- throw new IllegalPropertyValueStringException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
try {
validateValue(i, options);
- } catch (IllegalPropertyValueException e) {
- throw new IllegalPropertyValueStringException(this, value);
+ } catch (PropertyException e) {
+ throw PropertyException.illegalPropertyValueException(this, value);
}
return i;
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/StringPropertyDefinition.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/StringPropertyDefinition.java
index 1282d74..2a4a9b0 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/StringPropertyDefinition.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/StringPropertyDefinition.java
@@ -175,8 +175,8 @@
try {
validateValue(value, options);
- } catch (IllegalPropertyValueException e) {
- throw new IllegalPropertyValueStringException(this, value);
+ } catch (PropertyException e) {
+ throw PropertyException.illegalPropertyValueException(this, value);
}
return value;
@@ -275,7 +275,7 @@
if (pattern != null) {
Matcher matcher = pattern.matcher(value);
if (!matcher.matches()) {
- throw new IllegalPropertyValueException(this, value);
+ throw PropertyException.illegalPropertyValueException(this, value);
}
}
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/UnknownPropertyDefinitionException.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/UnknownPropertyDefinitionException.java
deleted file mode 100644
index 47914de..0000000
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/UnknownPropertyDefinitionException.java
+++ /dev/null
@@ -1,65 +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.forgerock.opendj.config;
-
-import static com.forgerock.opendj.ldap.AdminMessages.*;
-
-/**
- * Indicates that an unknown type of property definition was encountered. This
- * can occur as the management prototype develops and new kinds of property
- * definitions are added.
- */
-public final class UnknownPropertyDefinitionException extends PropertyException {
-
- // Generated serialization ID.
- private static final long serialVersionUID = 7042646409131322385L;
-
- // The visitor parameter if there was one.
- private Object parameter;
-
- /**
- * Creates a new unknown property definition exception.
- *
- * @param pd
- * The unknown property definition.
- * @param p
- * The visitor parameter if there was one.
- */
- public UnknownPropertyDefinitionException(PropertyDefinition<?> pd, Object p) {
- super(pd, ERR_UNKNOWN_PROPERTY_DEFINITION_EXCEPTION.get(pd.getName(), pd.getClass().getName()));
- this.parameter = p;
- }
-
- /**
- * Get the visitor parameter if there was one.
- *
- * @return Returns the visitor parameter if there was one.
- */
- public Object getParameter() {
- return parameter;
- }
-
-}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/IllegalManagedObjectNameException.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/IllegalManagedObjectNameException.java
index 6027109..d39cc79 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/IllegalManagedObjectNameException.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/IllegalManagedObjectNameException.java
@@ -28,7 +28,7 @@
import static com.forgerock.opendj.ldap.AdminMessages.*;
import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.config.IllegalPropertyValueStringException;
+import org.forgerock.opendj.config.PropertyException;
import org.forgerock.opendj.config.OperationsException;
import org.forgerock.opendj.config.PropertyDefinition;
import org.forgerock.opendj.config.PropertyDefinitionUsageBuilder;
@@ -60,7 +60,7 @@
} else if (namingPropertyDefinition != null) {
try {
namingPropertyDefinition.decodeValue(illegalName, options);
- } catch (IllegalPropertyValueStringException e) {
+ } catch (PropertyException e) {
PropertyDefinitionUsageBuilder builder = new PropertyDefinitionUsageBuilder(true);
return ERR_ILLEGAL_MANAGED_OBJECT_NAME_EXCEPTION_SYNTAX.get(illegalName,
namingPropertyDefinition.getName(), builder.getUsage(namingPropertyDefinition));
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/ManagedObject.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/ManagedObject.java
index 3762a79..410fe2a 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/ManagedObject.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/ManagedObject.java
@@ -32,7 +32,7 @@
import org.forgerock.opendj.config.AbstractManagedObjectDefinition;
import org.forgerock.opendj.config.Configuration;
import org.forgerock.opendj.config.ConfigurationClient;
-import org.forgerock.opendj.config.DefaultBehaviorException;
+import org.forgerock.opendj.config.PropertyException;
import org.forgerock.opendj.config.DefinitionDecodingException;
import org.forgerock.opendj.config.InstantiableRelationDefinition;
import org.forgerock.opendj.config.ManagedObjectAlreadyExistsException;
@@ -41,9 +41,6 @@
import org.forgerock.opendj.config.ManagedObjectPath;
import org.forgerock.opendj.config.OptionalRelationDefinition;
import org.forgerock.opendj.config.PropertyDefinition;
-import org.forgerock.opendj.config.PropertyIsMandatoryException;
-import org.forgerock.opendj.config.PropertyIsReadOnlyException;
-import org.forgerock.opendj.config.PropertyIsSingleValuedException;
import org.forgerock.opendj.config.PropertyProvider;
import org.forgerock.opendj.config.SetRelationDefinition;
import org.forgerock.opendj.config.SingletonRelationDefinition;
@@ -150,7 +147,7 @@
* The name of the child managed object.
* @param exceptions
* A collection in which to place any
- * {@link DefaultBehaviorException}s that occurred whilst
+ * {@link PropertyException}s that occurred whilst
* attempting to determine the managed object's default values.
* @return Returns a new child managed object bound to the specified
* instantiable relation.
@@ -162,7 +159,7 @@
*/
<C extends ConfigurationClient, S extends Configuration, C1 extends C> ManagedObject<C1> createChild(
InstantiableRelationDefinition<C, S> r, ManagedObjectDefinition<C1, ? extends S> d, String name,
- Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException;
+ Collection<PropertyException> exceptions) throws IllegalManagedObjectNameException;
/**
* Creates a new child managed object bound to the specified optional
@@ -186,7 +183,7 @@
* The definition of the managed object to be created.
* @param exceptions
* A collection in which to place any
- * {@link DefaultBehaviorException}s that occurred whilst
+ * {@link PropertyException}s that occurred whilst
* attempting to determine the managed object's default values.
* @return Returns a new child managed object bound to the specified
* optional relation.
@@ -196,7 +193,7 @@
*/
<C extends ConfigurationClient, S extends Configuration, C1 extends C> ManagedObject<C1> createChild(
OptionalRelationDefinition<C, S> r, ManagedObjectDefinition<C1, ? extends S> d,
- Collection<DefaultBehaviorException> exceptions);
+ Collection<PropertyException> exceptions);
/**
* Creates a new child managed object bound to the specified set relation.
@@ -220,7 +217,7 @@
* The definition of the managed object to be created.
* @param exceptions
* A collection in which to place any
- * {@link DefaultBehaviorException}s that occurred whilst
+ * {@link PropertyException}s that occurred whilst
* attempting to determine the managed object's default values.
* @return Returns a new child managed object bound to the specified set
* relation.
@@ -230,7 +227,7 @@
*/
<C extends ConfigurationClient, S extends Configuration, C1 extends C> ManagedObject<C1> createChild(
SetRelationDefinition<C, S> r, ManagedObjectDefinition<C1, ? extends S> d,
- Collection<DefaultBehaviorException> exceptions);
+ Collection<PropertyException> exceptions);
/**
* Retrieves an instantiable child managed object.
@@ -702,10 +699,10 @@
* @param value
* The new pending value for the property, or <code>null</code>
* if the property should be reset to its default behavior.
- * @throws PropertyIsReadOnlyException
+ * @throws PropertyException
* If this is not a new managed object and the property is
* read-only or for monitoring purposes.
- * @throws PropertyIsMandatoryException
+ * @throws PropertyException
* If an attempt was made to remove a mandatory property.
*/
<P> void setPropertyValue(PropertyDefinition<P> pd, P value);
@@ -724,13 +721,13 @@
* property (an empty set indicates that the property should be
* reset to its default behavior). The set will not be referenced
* by this managed object.
- * @throws PropertyIsSingleValuedException
+ * @throws PropertyException
* If an attempt was made to add multiple pending values to a
* single-valued property.
- * @throws PropertyIsReadOnlyException
+ * @throws PropertyException
* If this is not a new managed object and the property is
* read-only or for monitoring purposes.
- * @throws PropertyIsMandatoryException
+ * @throws PropertyException
* If an attempt was made to remove a mandatory property.
*/
<P> void setPropertyValues(PropertyDefinition<P> pd, Collection<P> values);
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/MissingMandatoryPropertiesException.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/MissingMandatoryPropertiesException.java
index b0c8570..25c3df3 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/MissingMandatoryPropertiesException.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/MissingMandatoryPropertiesException.java
@@ -34,7 +34,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.config.OperationsException;
-import org.forgerock.opendj.config.PropertyIsMandatoryException;
+import org.forgerock.opendj.config.PropertyException;
import org.forgerock.util.Reject;
/**
@@ -49,7 +49,7 @@
private static final long serialVersionUID = 6342522125252055588L;
// Create the message.
- private static LocalizableMessage createMessage(Collection<PropertyIsMandatoryException> causes) {
+ private static LocalizableMessage createMessage(Collection<PropertyException> causes) {
Reject.ifNull(causes);
Reject.ifFalse(!causes.isEmpty(), "causes should not be empty");
@@ -60,7 +60,7 @@
LocalizableMessageBuilder builder = new LocalizableMessageBuilder();
boolean isFirst = true;
- for (PropertyIsMandatoryException cause : causes) {
+ for (PropertyException cause : causes) {
if (!isFirst) {
builder.append(", ");
}
@@ -73,7 +73,7 @@
}
// The causes of this exception.
- private final Collection<PropertyIsMandatoryException> causes;
+ private final Collection<PropertyException> causes;
// Indicates whether the exception occurred during managed object
// creation.
@@ -98,10 +98,10 @@
* creation.
*/
public MissingMandatoryPropertiesException(LocalizableMessage ufn,
- Collection<PropertyIsMandatoryException> causes, boolean isCreate) {
+ Collection<PropertyException> causes, boolean isCreate) {
super(createMessage(causes));
- this.causes = new ArrayList<PropertyIsMandatoryException>(causes);
+ this.causes = new ArrayList<PropertyException>(causes);
this.ufn = ufn;
this.isCreate = isCreate;
}
@@ -112,7 +112,7 @@
* @return Returns the first exception that caused this exception.
*/
@Override
- public PropertyIsMandatoryException getCause() {
+ public PropertyException getCause() {
return causes.iterator().next();
}
@@ -122,7 +122,7 @@
* @return Returns an unmodifiable collection view of the causes of this
* exception.
*/
- public Collection<PropertyIsMandatoryException> getCauses() {
+ public Collection<PropertyException> getCauses() {
return Collections.unmodifiableCollection(causes);
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java
index 35e5c19..236db07 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/ldap/LDAPDriver.java
@@ -43,10 +43,9 @@
import org.forgerock.opendj.config.AggregationPropertyDefinition;
import org.forgerock.opendj.config.Configuration;
import org.forgerock.opendj.config.ConfigurationClient;
-import org.forgerock.opendj.config.DefaultBehaviorException;
+import org.forgerock.opendj.config.PropertyException;
import org.forgerock.opendj.config.DefinitionDecodingException;
import org.forgerock.opendj.config.DefinitionResolver;
-import org.forgerock.opendj.config.IllegalPropertyValueStringException;
import org.forgerock.opendj.config.InstantiableRelationDefinition;
import org.forgerock.opendj.config.LDAPProfile;
import org.forgerock.opendj.config.ManagedObjectDefinition;
@@ -55,9 +54,6 @@
import org.forgerock.opendj.config.PropertyDefinition;
import org.forgerock.opendj.config.PropertyDefinitionVisitor;
import org.forgerock.opendj.config.PropertyDefinitionsOptions;
-import org.forgerock.opendj.config.PropertyException;
-import org.forgerock.opendj.config.PropertyIsMandatoryException;
-import org.forgerock.opendj.config.PropertyIsSingleValuedException;
import org.forgerock.opendj.config.PropertyOption;
import org.forgerock.opendj.config.Reference;
import org.forgerock.opendj.config.RelationDefinition;
@@ -100,7 +96,7 @@
* @param options
* Decoding options for property definitions.
* @return Returns the decoded LDAP value.
- * @throws IllegalPropertyValueStringException
+ * @throws PropertyException
* If the property value could not be decoded because it was
* invalid.
*/
@@ -126,7 +122,7 @@
Reference<C, S> reference = Reference.parseDN(d.getParentPath(), d.getRelationDefinition(), p);
return reference.getName();
} catch (IllegalArgumentException e) {
- throw new IllegalPropertyValueStringException(d, p);
+ throw PropertyException.illegalPropertyValueException(d, p);
}
}
@@ -278,11 +274,11 @@
// Sanity check the returned values.
if (values.size() > 1 && !propertyDef.hasOption(PropertyOption.MULTI_VALUED)) {
- throw new PropertyIsSingleValuedException(propertyDef);
+ throw PropertyException.propertyIsSingleValuedException(propertyDef);
}
if (values.isEmpty() && propertyDef.hasOption(PropertyOption.MANDATORY)) {
- throw new PropertyIsMandatoryException(propertyDef);
+ throw PropertyException.propertyIsMandatoryException(propertyDef);
}
if (values.isEmpty()) {
@@ -503,7 +499,7 @@
if (activeValues.size() > 1 && !propertyDef.hasOption(PropertyOption.MULTI_VALUED)) {
// This exception takes precedence over previous exceptions.
- exception = new PropertyIsSingleValuedException(propertyDef);
+ exception = PropertyException.propertyIsSingleValuedException(propertyDef);
P value = activeValues.first();
activeValues.clear();
activeValues.add(value);
@@ -513,7 +509,7 @@
Collection<P> defaultValues;
try {
defaultValues = findDefaultValues(path, propertyDef, false);
- } catch (DefaultBehaviorException e) {
+ } catch (PropertyException e) {
defaultValues = Collections.emptySet();
exception = e;
}
@@ -524,7 +520,7 @@
// The active values maybe empty because of a previous
// exception.
if (exception == null) {
- exception = new PropertyIsMandatoryException(propertyDef);
+ exception = PropertyException.propertyIsMandatoryException(propertyDef);
}
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/AbstractManagedObject.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/AbstractManagedObject.java
index 6718a02..4212f8c 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/AbstractManagedObject.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/AbstractManagedObject.java
@@ -38,10 +38,9 @@
import org.forgerock.opendj.config.Configuration;
import org.forgerock.opendj.config.ConfigurationClient;
import org.forgerock.opendj.config.Constraint;
-import org.forgerock.opendj.config.DefaultBehaviorException;
+import org.forgerock.opendj.config.PropertyException;
import org.forgerock.opendj.config.DefaultManagedObject;
import org.forgerock.opendj.config.DefinitionDecodingException;
-import org.forgerock.opendj.config.IllegalPropertyValueStringException;
import org.forgerock.opendj.config.InstantiableRelationDefinition;
import org.forgerock.opendj.config.ManagedObjectAlreadyExistsException;
import org.forgerock.opendj.config.ManagedObjectDefinition;
@@ -50,8 +49,6 @@
import org.forgerock.opendj.config.OptionalRelationDefinition;
import org.forgerock.opendj.config.PropertyDefinition;
import org.forgerock.opendj.config.PropertyDefinitionsOptions;
-import org.forgerock.opendj.config.PropertyIsMandatoryException;
-import org.forgerock.opendj.config.PropertyIsReadOnlyException;
import org.forgerock.opendj.config.PropertyOption;
import org.forgerock.opendj.config.RelationDefinition;
import org.forgerock.opendj.config.RelationDefinitionVisitor;
@@ -267,12 +264,12 @@
public final void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException,
ConcurrentModificationException, OperationRejectedException, ErrorResultException {
// First make sure all mandatory properties are defined.
- List<PropertyIsMandatoryException> exceptions = new LinkedList<PropertyIsMandatoryException>();
+ List<PropertyException> exceptions = new LinkedList<PropertyException>();
for (PropertyDefinition<?> pd : definition.getAllPropertyDefinitions()) {
Property<?> p = getProperty(pd);
if (pd.hasOption(PropertyOption.MANDATORY) && p.getEffectiveValues().isEmpty()) {
- exceptions.add(new PropertyIsMandatoryException(pd));
+ exceptions.add(PropertyException.propertyIsMandatoryException(pd));
}
}
@@ -339,7 +336,7 @@
@Override
public final <C extends ConfigurationClient, S extends Configuration, C1 extends C> ManagedObject<C1> createChild(
InstantiableRelationDefinition<C, S> r, ManagedObjectDefinition<C1, ? extends S> d, String name,
- Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException {
+ Collection<PropertyException> exceptions) throws IllegalManagedObjectNameException {
validateRelationDefinition(r);
// Empty names are not allowed.
@@ -353,7 +350,7 @@
if (pd != null) {
try {
pd.decodeValue(name, propertyDefOptions);
- } catch (IllegalPropertyValueStringException e) {
+ } catch (PropertyException e) {
throw new IllegalManagedObjectNameException(name, pd, propertyDefOptions);
}
}
@@ -368,7 +365,7 @@
@Override
public final <C extends ConfigurationClient, S extends Configuration, C1 extends C> ManagedObject<C1> createChild(
OptionalRelationDefinition<C, S> r, ManagedObjectDefinition<C1, ? extends S> d,
- Collection<DefaultBehaviorException> exceptions) {
+ Collection<PropertyException> exceptions) {
validateRelationDefinition(r);
ManagedObjectPath<C1, ? extends S> childPath = path.child(r, d);
return createNewManagedObject(d, childPath, null, null, exceptions);
@@ -380,7 +377,7 @@
@Override
public final <C extends ConfigurationClient, S extends Configuration, C1 extends C> ManagedObject<C1> createChild(
SetRelationDefinition<C, S> r, ManagedObjectDefinition<C1, ? extends S> d,
- Collection<DefaultBehaviorException> exceptions) {
+ Collection<PropertyException> exceptions) {
validateRelationDefinition(r);
ManagedObjectPath<C1, ? extends S> childPath = path.child(r, d);
@@ -663,11 +660,11 @@
@Override
public final <P> void setPropertyValues(PropertyDefinition<P> pd, Collection<P> values) {
if (pd.hasOption(PropertyOption.MONITORING)) {
- throw new PropertyIsReadOnlyException(pd);
+ throw PropertyException.propertyIsReadOnlyException(pd);
}
if (existsOnServer && pd.hasOption(PropertyOption.READ_ONLY)) {
- throw new PropertyIsReadOnlyException(pd);
+ throw PropertyException.propertyIsReadOnlyException(pd);
}
properties.setPropertyValues(pd, values, propertyDefOptions);
@@ -800,12 +797,12 @@
// values.
private <M extends ConfigurationClient, P> ManagedObject<M> createNewManagedObject(
ManagedObjectDefinition<M, ?> d, ManagedObjectPath<M, ?> p, PropertyDefinition<P> namingPropertyDefinition,
- String name, Collection<DefaultBehaviorException> exceptions) {
+ String name, Collection<PropertyException> exceptions) {
PropertySet childProperties = new PropertySet();
for (PropertyDefinition<?> pd : d.getAllPropertyDefinitions()) {
try {
createProperty(childProperties, p, pd);
- } catch (DefaultBehaviorException e) {
+ } catch (PropertyException e) {
// Add the exception if requested.
if (exceptions != null) {
exceptions.add(e);
@@ -829,7 +826,7 @@
Driver context = getDriver();
Collection<P> defaultValues = context.findDefaultValues(p, pd, true);
properties.addProperty(pd, defaultValues, Collections.<P> emptySet());
- } catch (DefaultBehaviorException e) {
+ } catch (PropertyException e) {
// Make sure that we have still created the property.
properties.addProperty(pd, Collections.<P> emptySet(), Collections.<P> emptySet());
throw e;
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/Driver.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/Driver.java
index e33ffb8..712b90b 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/Driver.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/Driver.java
@@ -25,6 +25,9 @@
*/
package org.forgerock.opendj.config.client.spi;
+import static org.forgerock.opendj.config.PropertyException.defaultBehaviorException;
+import static org.forgerock.opendj.config.PropertyException.propertyIsSingleValuedException;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -40,19 +43,16 @@
import org.forgerock.opendj.config.Configuration;
import org.forgerock.opendj.config.ConfigurationClient;
import org.forgerock.opendj.config.Constraint;
-import org.forgerock.opendj.config.DefaultBehaviorException;
+import org.forgerock.opendj.config.PropertyException;
import org.forgerock.opendj.config.DefaultBehaviorProviderVisitor;
import org.forgerock.opendj.config.DefinedDefaultBehaviorProvider;
import org.forgerock.opendj.config.DefinitionDecodingException;
-import org.forgerock.opendj.config.IllegalPropertyValueStringException;
import org.forgerock.opendj.config.InstantiableRelationDefinition;
import org.forgerock.opendj.config.ManagedObjectNotFoundException;
import org.forgerock.opendj.config.ManagedObjectPath;
import org.forgerock.opendj.config.OptionalRelationDefinition;
import org.forgerock.opendj.config.PropertyDefinition;
import org.forgerock.opendj.config.PropertyDefinitionsOptions;
-import org.forgerock.opendj.config.PropertyException;
-import org.forgerock.opendj.config.PropertyIsSingleValuedException;
import org.forgerock.opendj.config.PropertyNotFoundException;
import org.forgerock.opendj.config.PropertyOption;
import org.forgerock.opendj.config.RelationDefinition;
@@ -85,7 +85,7 @@
// Any exception that occurred whilst retrieving inherited default
// values.
- private DefaultBehaviorException exception = null;
+ private PropertyException exception = null;
// The path of the managed object containing the first property.
private final ManagedObjectPath<?, ?> firstPath;
@@ -113,7 +113,7 @@
try {
return getInheritedProperty(d.getManagedObjectPath(), d.getManagedObjectDefinition(),
d.getPropertyName());
- } catch (DefaultBehaviorException e) {
+ } catch (PropertyException e) {
exception = e;
return Collections.emptySet();
}
@@ -138,8 +138,8 @@
for (String stringValue : stringValues) {
try {
values.add(nextProperty.decodeValue(stringValue, propertyDefOptions));
- } catch (IllegalPropertyValueStringException e) {
- exception = new DefaultBehaviorException(nextProperty, e);
+ } catch (PropertyException e) {
+ exception = PropertyException.defaultBehaviorException(nextProperty, e);
break;
}
}
@@ -155,7 +155,7 @@
try {
return getInheritedProperty(d.getManagedObjectPath(nextPath), d.getManagedObjectDefinition(),
d.getPropertyName());
- } catch (DefaultBehaviorException e) {
+ } catch (PropertyException e) {
exception = e;
return Collections.emptySet();
}
@@ -181,7 +181,7 @@
}
if (values.size() > 1 && !pd.hasOption(PropertyOption.MULTI_VALUED)) {
- throw new DefaultBehaviorException(pd, new PropertyIsSingleValuedException(pd));
+ throw defaultBehaviorException(pd, propertyIsSingleValuedException(pd));
}
return values;
@@ -195,7 +195,7 @@
// corresponds to the path.
AbstractManagedObjectDefinition<?, ?> supr = target.getManagedObjectDefinition();
if (!supr.isParentOf(d)) {
- throw new DefaultBehaviorException(nextProperty, new DefinitionDecodingException(supr,
+ throw PropertyException.defaultBehaviorException(nextProperty, new DefinitionDecodingException(supr,
Reason.WRONG_TYPE_INFORMATION));
}
@@ -238,19 +238,17 @@
// object.
return getPropertyValues(target, pd2);
}
- } catch (DefaultBehaviorException e) {
- // Wrap any errors due to recursion.
- throw new DefaultBehaviorException(pd1, e);
- } catch (DefinitionDecodingException e) {
- throw new DefaultBehaviorException(pd1, e);
- } catch (PropertyNotFoundException e) {
- throw new DefaultBehaviorException(pd1, e);
- } catch (ErrorResultException e) {
- throw new DefaultBehaviorException(pd1, e);
- } catch (ManagedObjectNotFoundException e) {
- throw new DefaultBehaviorException(pd1, e);
} catch (PropertyException e) {
- throw new DefaultBehaviorException(pd1, e);
+ // Wrap any errors due to recursion.
+ throw PropertyException.defaultBehaviorException(pd1, e);
+ } catch (DefinitionDecodingException e) {
+ throw PropertyException.defaultBehaviorException(pd1, e);
+ } catch (PropertyNotFoundException e) {
+ throw PropertyException.defaultBehaviorException(pd1, e);
+ } catch (ErrorResultException e) {
+ throw PropertyException.defaultBehaviorException(pd1, e);
+ } catch (ManagedObjectNotFoundException e) {
+ throw PropertyException.defaultBehaviorException(pd1, e);
}
}
};
@@ -588,7 +586,7 @@
* @param isCreate
* Indicates whether the managed object has been created yet.
* @return Returns the default values for the specified property.
- * @throws DefaultBehaviorException
+ * @throws PropertyException
* If the default values could not be retrieved or decoded
* properly.
*/
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/PropertySet.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/PropertySet.java
index c03de85..7d524e6 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/PropertySet.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/client/spi/PropertySet.java
@@ -33,11 +33,9 @@
import java.util.SortedSet;
import java.util.TreeSet;
-import org.forgerock.opendj.config.IllegalPropertyValueException;
+import org.forgerock.opendj.config.PropertyException;
import org.forgerock.opendj.config.PropertyDefinition;
import org.forgerock.opendj.config.PropertyDefinitionsOptions;
-import org.forgerock.opendj.config.PropertyIsMandatoryException;
-import org.forgerock.opendj.config.PropertyIsSingleValuedException;
import org.forgerock.opendj.config.PropertyOption;
/**
@@ -285,13 +283,13 @@
* by this managed object.
* @param options
* Options to validate property definitions values.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If a new pending value is deemed to be invalid according to
* the property definition.
- * @throws PropertyIsSingleValuedException
+ * @throws PropertyException
* If an attempt was made to add multiple pending values to a
* single-valued property.
- * @throws PropertyIsMandatoryException
+ * @throws PropertyException
* If an attempt was made to remove a mandatory property.
* @throws IllegalArgumentException
* If the specified property definition is not associated with
@@ -302,13 +300,13 @@
MyProperty<T> property = (MyProperty<T>) getProperty(d);
if (values.size() > 1 && !d.hasOption(PropertyOption.MULTI_VALUED)) {
- throw new PropertyIsSingleValuedException(d);
+ throw PropertyException.propertyIsSingleValuedException(d);
}
if (values.isEmpty() && d.hasOption(PropertyOption.MANDATORY)) {
// But only if there are no default values.
if (property.getDefaultValues().isEmpty()) {
- throw new PropertyIsMandatoryException(d);
+ throw PropertyException.propertyIsMandatoryException(d);
}
}
diff --git a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagementContext.java b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagementContext.java
index e6fab0f..a75c20a 100644
--- a/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagementContext.java
+++ b/opendj-sdk/opendj-config/src/main/java/org/forgerock/opendj/config/server/ServerManagementContext.java
@@ -28,6 +28,8 @@
import static com.forgerock.opendj.ldap.AdminMessages.*;
import static com.forgerock.opendj.util.StaticUtils.*;
+import static org.forgerock.opendj.config.PropertyException.defaultBehaviorException;
+import static org.forgerock.opendj.config.PropertyException.propertyIsSingleValuedException;
import java.util.ArrayList;
import java.util.Collection;
@@ -50,22 +52,17 @@
import org.forgerock.opendj.config.AliasDefaultBehaviorProvider;
import org.forgerock.opendj.config.Configuration;
import org.forgerock.opendj.config.ConfigurationClient;
-import org.forgerock.opendj.config.DefaultBehaviorException;
+import org.forgerock.opendj.config.PropertyException;
import org.forgerock.opendj.config.DefaultBehaviorProviderVisitor;
import org.forgerock.opendj.config.DefinedDefaultBehaviorProvider;
import org.forgerock.opendj.config.DefinitionDecodingException;
import org.forgerock.opendj.config.DefinitionResolver;
-import org.forgerock.opendj.config.IllegalPropertyValueException;
-import org.forgerock.opendj.config.IllegalPropertyValueStringException;
import org.forgerock.opendj.config.LDAPProfile;
import org.forgerock.opendj.config.ManagedObjectDefinition;
import org.forgerock.opendj.config.ManagedObjectPath;
import org.forgerock.opendj.config.PropertyDefinition;
import org.forgerock.opendj.config.PropertyDefinitionVisitor;
import org.forgerock.opendj.config.PropertyDefinitionsOptions;
-import org.forgerock.opendj.config.PropertyException;
-import org.forgerock.opendj.config.PropertyIsMandatoryException;
-import org.forgerock.opendj.config.PropertyIsSingleValuedException;
import org.forgerock.opendj.config.PropertyNotFoundException;
import org.forgerock.opendj.config.PropertyOption;
import org.forgerock.opendj.config.Reference;
@@ -99,7 +96,7 @@
// Any exception that occurred whilst retrieving inherited default
// values.
- private DefaultBehaviorException exception = null;
+ private PropertyException exception = null;
// Optional new configuration entry which does not yet exist in
// the configuration back-end.
@@ -123,7 +120,7 @@
try {
return getInheritedProperty(d.getManagedObjectPath(), d.getManagedObjectDefinition(),
d.getPropertyName());
- } catch (DefaultBehaviorException e) {
+ } catch (PropertyException e) {
exception = e;
return Collections.emptySet();
}
@@ -146,8 +143,8 @@
for (String stringValue : stringValues) {
try {
values.add(nextProperty.decodeValue(stringValue, propertyDefOptions));
- } catch (IllegalPropertyValueStringException e) {
- exception = new DefaultBehaviorException(nextProperty, e);
+ } catch (PropertyException e) {
+ exception = PropertyException.defaultBehaviorException(nextProperty, e);
break;
}
}
@@ -162,7 +159,7 @@
try {
return getInheritedProperty(d.getManagedObjectPath(nextPath), d.getManagedObjectDefinition(),
d.getPropertyName());
- } catch (DefaultBehaviorException e) {
+ } catch (PropertyException e) {
exception = e;
return Collections.emptySet();
}
@@ -187,7 +184,7 @@
}
if (values.size() > 1 && !propertyDef.hasOption(PropertyOption.MULTI_VALUED)) {
- throw new DefaultBehaviorException(propertyDef, new PropertyIsSingleValuedException(propertyDef));
+ throw defaultBehaviorException(propertyDef, propertyIsSingleValuedException(propertyDef));
}
return values;
@@ -201,7 +198,7 @@
// corresponds to the path.
AbstractManagedObjectDefinition<?, ?> supr = target.getManagedObjectDefinition();
if (!supr.isParentOf(definition)) {
- throw new DefaultBehaviorException(nextProperty, new DefinitionDecodingException(supr,
+ throw PropertyException.defaultBehaviorException(nextProperty, new DefinitionDecodingException(supr,
Reason.WRONG_TYPE_INFORMATION));
}
@@ -250,15 +247,13 @@
return pvalues;
}
} catch (DefinitionDecodingException e) {
- throw new DefaultBehaviorException(propDef1, e);
+ throw PropertyException.defaultBehaviorException(propDef1, e);
} catch (PropertyNotFoundException e) {
- throw new DefaultBehaviorException(propDef1, e);
- } catch (IllegalPropertyValueException e) {
- throw new DefaultBehaviorException(propDef1, e);
- } catch (IllegalPropertyValueStringException e) {
- throw new DefaultBehaviorException(propDef1, e);
+ throw PropertyException.defaultBehaviorException(propDef1, e);
+ } catch (PropertyException e) {
+ throw PropertyException.defaultBehaviorException(propDef1, e);
} catch (ConfigException e) {
- throw new DefaultBehaviorException(propDef1, e);
+ throw PropertyException.defaultBehaviorException(propDef1, e);
}
}
}
@@ -313,7 +308,7 @@
* @param options
* Options to decode property definitions values.
* @return Returns the decoded LDAP value.
- * @throws IllegalPropertyValueStringException
+ * @throws PropertyException
* If the property value could not be decoded because it was
* invalid.
*/
@@ -339,7 +334,7 @@
Reference<C, S> reference = Reference.parseDN(d.getParentPath(), d.getRelationDefinition(), p);
return reference.getName();
} catch (IllegalArgumentException e) {
- throw new IllegalPropertyValueStringException(d, p);
+ throw PropertyException.illegalPropertyValueException(d, p);
}
}
@@ -726,7 +721,7 @@
for (String value : attributeValues) {
try {
pvalues.add(ValueDecoder.decode(propertyDef, value, propertyDefOptions));
- } catch (IllegalPropertyValueStringException e) {
+ } catch (PropertyException e) {
exception = e;
}
}
@@ -734,14 +729,14 @@
// No values defined so get the defaults.
try {
pvalues.addAll(getDefaultValues(path, propertyDef, newConfigEntry));
- } catch (DefaultBehaviorException e) {
+ } catch (PropertyException e) {
exception = e;
}
}
if (pvalues.size() > 1 && !propertyDef.hasOption(PropertyOption.MULTI_VALUED)) {
// This exception takes precedence over previous exceptions.
- exception = new PropertyIsSingleValuedException(propertyDef);
+ exception = PropertyException.propertyIsSingleValuedException(propertyDef);
T value = pvalues.first();
pvalues.clear();
pvalues.add(value);
@@ -750,7 +745,7 @@
if (pvalues.isEmpty() && propertyDef.hasOption(PropertyOption.MANDATORY)) {
// The values maybe empty because of a previous exception.
if (exception == null) {
- exception = new PropertyIsMandatoryException(propertyDef);
+ exception = PropertyException.propertyIsMandatoryException(propertyDef);
}
}
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/AttributeTypePropertyDefinitionTest.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/AttributeTypePropertyDefinitionTest.java
index 5b4db81..d47deec 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/AttributeTypePropertyDefinitionTest.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/AttributeTypePropertyDefinitionTest.java
@@ -65,7 +65,7 @@
return new Object[][] { { "dummy-type-xxx" } };
}
- @Test(dataProvider = "valueIllegalData", expectedExceptions = { IllegalPropertyValueStringException.class })
+ @Test(dataProvider = "valueIllegalData", expectedExceptions = { PropertyException.class })
public void testDecodeValueIllegal(String value) {
AttributeTypePropertyDefinition propertyDef = createPropertyDefinition();
propertyDef.decodeValue(value, new PropertyDefinitionsOptions());
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/BooleanPropertyDefinitionTest.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/BooleanPropertyDefinitionTest.java
index be998a2..ba84176 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/BooleanPropertyDefinitionTest.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/BooleanPropertyDefinitionTest.java
@@ -71,7 +71,7 @@
}
@Test(dataProvider = "decodeValueDataIllegal", expectedExceptions = { NullPointerException.class,
- IllegalPropertyValueStringException.class })
+ PropertyException.class })
public void testDecodeValueIllegal(String value) {
BooleanPropertyDefinition def = createPropertyDefinition();
def.decodeValue(value, PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/ClassPropertyDefinitionTest.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/ClassPropertyDefinitionTest.java
index 50f3f54..5ca63c5 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/ClassPropertyDefinitionTest.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/ClassPropertyDefinitionTest.java
@@ -131,7 +131,7 @@
{ "java.lang.Runnable", "java.lang.String", Number.class, Number.class }, };
}
- @Test(dataProvider = "loadClassesIllegal", expectedExceptions = { IllegalPropertyValueException.class })
+ @Test(dataProvider = "loadClassesIllegal", expectedExceptions = { PropertyException.class })
public <T> void testLoadClassIllegal(String interfaceName, String loadClassName, Class<T> instanceOfClass,
Class<?> expectedClass) {
ClassPropertyDefinition.Builder localBuilder = ClassPropertyDefinition.createBuilder(RootCfgDefn.getInstance(),
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/DNPropertyDefinitionTest.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/DNPropertyDefinitionTest.java
index 1481182..f114d8e 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/DNPropertyDefinitionTest.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/DNPropertyDefinitionTest.java
@@ -97,7 +97,7 @@
propertyDef.validateValue(DN.valueOf(valueToValidate), PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
}
- @Test(dataProvider = "illegalValues", expectedExceptions = IllegalPropertyValueException.class)
+ @Test(dataProvider = "illegalValues", expectedExceptions = PropertyException.class)
public void testValidateIllegalValues(String baseDN, String valueToValidate) {
DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition.createBuilder(RootCfgDefn.getInstance(),
"test-property");
@@ -115,7 +115,7 @@
propertyDef.decodeValue(valueToValidate, PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
}
- @Test(dataProvider = "illegalValues", expectedExceptions = IllegalPropertyValueStringException.class)
+ @Test(dataProvider = "illegalValues", expectedExceptions = PropertyException.class)
public void testDecodeIllegalValues(String baseDN, String valueToValidate) {
DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition.createBuilder(RootCfgDefn.getInstance(),
"test-property");
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/DurationPropertyDefinitionTest.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/DurationPropertyDefinitionTest.java
index 97a7796..f8b584c 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/DurationPropertyDefinitionTest.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/DurationPropertyDefinitionTest.java
@@ -127,7 +127,7 @@
def.decodeValue("unlimited", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
}
- @Test(expectedExceptions = IllegalPropertyValueStringException.class)
+ @Test(expectedExceptions = PropertyException.class)
public void testAllowUnlimitedIsFalse() {
DurationPropertyDefinition.Builder builder = createTestBuilder();
builder.setAllowUnlimited(false);
@@ -135,7 +135,7 @@
def.decodeValue("unlimited", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
}
- @Test(expectedExceptions = IllegalPropertyValueException.class)
+ @Test(expectedExceptions = PropertyException.class)
public void testAllowUnlimitedIsFalseNumValue() {
DurationPropertyDefinition.Builder builder = createTestBuilder();
builder.setAllowUnlimited(false);
@@ -177,7 +177,7 @@
}
@Test(dataProvider = "illegalValidateValueData", expectedExceptions = { AssertionError.class,
- NullPointerException.class, IllegalPropertyValueException.class })
+ NullPointerException.class, PropertyException.class })
public void testValidateValueIllegal(Long lowLimitInMillis, Long highLimitInMillis,
boolean isAllowUnlimited, Long valueInSeconds) {
DurationPropertyDefinition.Builder builder = createTestBuilder();
@@ -224,7 +224,7 @@
return true;
}
@SuppressWarnings("unused")
- public Boolean visitUnknown(PropertyDefinition<?> d, Void o) throws UnknownPropertyDefinitionException {
+ public Boolean visitUnknown(PropertyDefinition<?> d, Void o) throws PropertyException {
return false;
}
};
@@ -329,7 +329,7 @@
};
}
- @Test(dataProvider = "decodeValueDataIllegal", expectedExceptions = { IllegalPropertyValueStringException.class })
+ @Test(dataProvider = "decodeValueDataIllegal", expectedExceptions = { PropertyException.class })
public void testDecodeValue(String valueToDecode) {
DurationPropertyDefinition.Builder builder = createTestBuilder();
builder.setAllowUnlimited(false);
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/EnumPropertyDefinitionTest.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/EnumPropertyDefinitionTest.java
index b35ecab..6cb5697 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/EnumPropertyDefinitionTest.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/EnumPropertyDefinitionTest.java
@@ -114,7 +114,7 @@
* to decode
*/
@Test(dataProvider = "decodeValueIllegalData", expectedExceptions = { NullPointerException.class,
- IllegalPropertyValueStringException.class })
+ PropertyException.class })
public void testDecodeValueIllegalData(String value) {
EnumPropertyDefinition<?> def = builder.getInstance();
def.decodeValue(value, PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/IntegerPropertyDefinitionTest.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/IntegerPropertyDefinitionTest.java
index 0ad3c1d..10412c1 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/IntegerPropertyDefinitionTest.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/IntegerPropertyDefinitionTest.java
@@ -95,7 +95,7 @@
propertyDef.decodeValue("unlimited", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
}
- @Test(expectedExceptions = IllegalPropertyValueStringException.class)
+ @Test(expectedExceptions = PropertyException.class)
public void testIsAllowUnlimitedFalse() {
IntegerPropertyDefinition.Builder builder = createTestBuilder();
builder.setAllowUnlimited(false);
@@ -103,7 +103,7 @@
propertyDef.decodeValue("unlimited", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
}
- @Test(expectedExceptions = IllegalPropertyValueException.class)
+ @Test(expectedExceptions = PropertyException.class)
public void testIsAllowUnlimitedInteger() {
IntegerPropertyDefinition.Builder builder = createTestBuilder();
builder.setAllowUnlimited(false);
@@ -145,7 +145,7 @@
}
@Test(dataProvider = "illegalValidateValueData", expectedExceptions = { AssertionError.class,
- NullPointerException.class, IllegalPropertyValueException.class })
+ NullPointerException.class, PropertyException.class })
public void testValidateValueIllegal(Integer low, Integer high, boolean allowUnlimited, Integer value) {
IntegerPropertyDefinition.Builder builder = createTestBuilder();
builder.setLowerLimit(low);
@@ -181,7 +181,7 @@
}
@SuppressWarnings("unused")
- public Boolean visitUnknown(PropertyDefinition<?> d, Void o) throws UnknownPropertyDefinitionException {
+ public Boolean visitUnknown(PropertyDefinition<?> d, Void o) throws PropertyException {
return false;
}
};
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/SizePropertyDefinitionTest.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/SizePropertyDefinitionTest.java
index 864e0a7..ed58ee2 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/SizePropertyDefinitionTest.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/SizePropertyDefinitionTest.java
@@ -102,7 +102,7 @@
propertyDef.decodeValue("unlimited", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
}
- @Test(expectedExceptions = IllegalPropertyValueStringException.class)
+ @Test(expectedExceptions = PropertyException.class)
public void testIsAllowUnlimitedFalse() {
SizePropertyDefinition.Builder builder = createTestBuilder();
builder.setAllowUnlimited(false);
@@ -110,7 +110,7 @@
propertyDef.decodeValue("unlimited", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
}
- @Test(expectedExceptions = IllegalPropertyValueException.class)
+ @Test(expectedExceptions = PropertyException.class)
public void testIsAllowUnlimitedNumeric() {
SizePropertyDefinition.Builder builder = createTestBuilder();
builder.setAllowUnlimited(false);
@@ -152,7 +152,7 @@
}
@Test(dataProvider = "illegalValidateValueData", expectedExceptions = { AssertionError.class,
- NullPointerException.class, IllegalPropertyValueException.class })
+ NullPointerException.class, PropertyException.class })
public void testValidateValueIllegal(Long low, Long high, boolean allowUnlimited, Long valueToValidate) {
SizePropertyDefinition.Builder builder = createTestBuilder();
builder.setLowerLimit(low);
@@ -200,7 +200,7 @@
return true;
}
@SuppressWarnings("unused")
- public Boolean visitUnknown(PropertyDefinition<?> d, Void o) throws UnknownPropertyDefinitionException {
+ public Boolean visitUnknown(PropertyDefinition<?> d, Void o) throws PropertyException {
return false;
}
};
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/StringPropertyDefinitionTest.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/StringPropertyDefinitionTest.java
index 26cadbe..98e20af 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/StringPropertyDefinitionTest.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/StringPropertyDefinitionTest.java
@@ -46,7 +46,7 @@
}
// TODO : I18N problem
- @Test(enabled = false, expectedExceptions = IllegalPropertyValueException.class)
+ @Test(enabled = false, expectedExceptions = PropertyException.class)
public void testValidateValuePatternDoesNotMatch() {
StringPropertyDefinition d = getDefinition(true, "^[a-z]+$");
d.validateValue("abc123", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
@@ -59,7 +59,7 @@
}
// TODO : I18N problem
- @Test(enabled = false, expectedExceptions = IllegalPropertyValueStringException.class)
+ @Test(enabled = false, expectedExceptions = PropertyException.class)
public void testDecodeValuePatternDoesNotMatch() {
StringPropertyDefinition d = getDefinition(true, "^[a-z]+$");
d.decodeValue("abc123", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgClient.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgClient.java
index 4d33ae6..c813dde 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgClient.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgClient.java
@@ -63,10 +63,10 @@
*
* @param values
* The values of the "aggregation-property" property.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If one or more of the new values are invalid.
*/
- void setAggregationProperty(Collection<String> values) throws IllegalPropertyValueException;
+ void setAggregationProperty(Collection<String> values) throws PropertyException;
/**
* Get the "mandatory-boolean-property" property.
@@ -84,10 +84,10 @@
*
* @param value
* The value of the "mandatory-boolean-property" property.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If the new value is invalid.
*/
- void setMandatoryBooleanProperty(boolean value) throws IllegalPropertyValueException;
+ void setMandatoryBooleanProperty(boolean value) throws PropertyException;
/**
* Get the "mandatory-class-property" property.
@@ -105,10 +105,10 @@
*
* @param value
* The value of the "mandatory-class-property" property.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If the new value is invalid.
*/
- void setMandatoryClassProperty(String value) throws IllegalPropertyValueException;
+ void setMandatoryClassProperty(String value) throws PropertyException;
/**
* Get the "mandatory-read-only-attribute-type-property" property.
@@ -131,13 +131,13 @@
* @param value
* The value of the "mandatory-read-only-attribute-type-property"
* property.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If the new value is invalid.
- * @throws PropertyIsReadOnlyException
+ * @throws PropertyException
* If this Test Child is not being initialized.
*/
- void setMandatoryReadOnlyAttributeTypeProperty(AttributeType value) throws IllegalPropertyValueException,
- PropertyIsReadOnlyException;
+ void setMandatoryReadOnlyAttributeTypeProperty(AttributeType value) throws PropertyException,
+ PropertyException;
/**
* Get the "optional-multi-valued-dn-property1" property.
@@ -159,10 +159,10 @@
* @param values
* The values of the "optional-multi-valued-dn-property1"
* property.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If one or more of the new values are invalid.
*/
- void setOptionalMultiValuedDNProperty1(Collection<DN> values) throws IllegalPropertyValueException;
+ void setOptionalMultiValuedDNProperty1(Collection<DN> values) throws PropertyException;
/**
* Get the "optional-multi-valued-dn-property2" property.
@@ -184,9 +184,9 @@
* @param values
* The values of the "optional-multi-valued-dn-property2"
* property.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If one or more of the new values are invalid.
*/
- void setOptionalMultiValuedDNProperty2(Collection<DN> values) throws IllegalPropertyValueException;
+ void setOptionalMultiValuedDNProperty2(Collection<DN> values) throws PropertyException;
}
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgDefn.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgDefn.java
index c406bba..5894dd1 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgDefn.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestChildCfgDefn.java
@@ -334,7 +334,7 @@
/**
* {@inheritDoc}
*/
- public void setMandatoryReadOnlyAttributeTypeProperty(AttributeType value) throws PropertyIsReadOnlyException {
+ public void setMandatoryReadOnlyAttributeTypeProperty(AttributeType value) throws PropertyException {
impl.setPropertyValue(INSTANCE.getMandatoryReadOnlyAttributeTypePropertyPropertyDefinition(), value);
}
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgClient.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgClient.java
index e1739d2..79033a4 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgClient.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgClient.java
@@ -68,10 +68,10 @@
*
* @param value
* The value of the "mandatory-boolean-property" property.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If the new value is invalid.
*/
- void setMandatoryBooleanProperty(boolean value) throws IllegalPropertyValueException;
+ void setMandatoryBooleanProperty(boolean value) throws PropertyException;
/**
* Get the "mandatory-class-property" property.
@@ -89,10 +89,10 @@
*
* @param value
* The value of the "mandatory-class-property" property.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If the new value is invalid.
*/
- void setMandatoryClassProperty(String value) throws IllegalPropertyValueException;
+ void setMandatoryClassProperty(String value) throws PropertyException;
/**
* Get the "mandatory-read-only-attribute-type-property" property.
@@ -115,13 +115,13 @@
* @param value
* The value of the "mandatory-read-only-attribute-type-property"
* property.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If the new value is invalid.
- * @throws PropertyIsReadOnlyException
+ * @throws PropertyException
* If this Test Parent is not being initialized.
*/
- void setMandatoryReadOnlyAttributeTypeProperty(AttributeType value) throws IllegalPropertyValueException,
- PropertyIsReadOnlyException;
+ void setMandatoryReadOnlyAttributeTypeProperty(AttributeType value) throws PropertyException,
+ PropertyException;
/**
* Get the "optional-multi-valued-dn-property" property.
@@ -141,10 +141,10 @@
* @param values
* The values of the "optional-multi-valued-dn-property"
* property.
- * @throws IllegalPropertyValueException
+ * @throws PropertyException
* If one or more of the new values are invalid.
*/
- void setOptionalMultiValuedDNProperty(Collection<DN> values) throws IllegalPropertyValueException;
+ void setOptionalMultiValuedDNProperty(Collection<DN> values) throws PropertyException;
/**
* Lists the Test Children.
@@ -195,7 +195,7 @@
* The name of the new Test Child.
* @param exceptions
* An optional collection in which to place any
- * {@link DefaultBehaviorException}s that occurred whilst
+ * {@link PropertyException}s that occurred whilst
* attempting to determine the default values of the Test Child.
* This argument can be <code>null<code>.
* @return Returns a new Test Child configuration instance.
@@ -203,7 +203,7 @@
* If the name is invalid.
*/
<C extends TestChildCfgClient> C createTestChild(ManagedObjectDefinition<C, ? extends TestChildCfg> d, String name,
- Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException;
+ Collection<PropertyException> exceptions) throws IllegalManagedObjectNameException;
/**
* Removes the named Test Child.
@@ -270,13 +270,13 @@
* The definition of the Optional Test Child to be created.
* @param exceptions
* An optional collection in which to place any
- * {@link DefaultBehaviorException}s that occurred whilst
+ * {@link PropertyException}s that occurred whilst
* attempting to determine the default values of the Optional
* Test Child. This argument can be <code>null<code>.
* @return Returns a new Optional Test Child configuration instance.
*/
<C extends TestChildCfgClient> C createOptionalTestChild(ManagedObjectDefinition<C, ? extends TestChildCfg> d,
- Collection<DefaultBehaviorException> exceptions);
+ Collection<PropertyException> exceptions);
/**
* Removes the Optional Test Child if it exists.
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgDefn.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgDefn.java
index 2d29dcc..4fc0cd0 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgDefn.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/TestParentCfgDefn.java
@@ -299,7 +299,7 @@
/**
* {@inheritDoc}
*/
- public void setMandatoryReadOnlyAttributeTypeProperty(AttributeType value) throws PropertyIsReadOnlyException {
+ public void setMandatoryReadOnlyAttributeTypeProperty(AttributeType value) throws PropertyException {
impl.setPropertyValue(INSTANCE.getMandatoryReadOnlyAttributeTypePropertyPropertyDefinition(), value);
}
@@ -337,7 +337,7 @@
* {@inheritDoc}
*/
public <M extends TestChildCfgClient> M createTestChild(ManagedObjectDefinition<M, ? extends TestChildCfg> d,
- String name, Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException {
+ String name, Collection<PropertyException> exceptions) throws IllegalManagedObjectNameException {
return impl.createChild(INSTANCE.getTestChildrenRelationDefinition(), d, name, exceptions)
.getConfiguration();
}
@@ -370,7 +370,7 @@
* {@inheritDoc}
*/
public <M extends TestChildCfgClient> M createOptionalTestChild(
- ManagedObjectDefinition<M, ? extends TestChildCfg> d, Collection<DefaultBehaviorException> exceptions) {
+ ManagedObjectDefinition<M, ? extends TestChildCfg> d, Collection<PropertyException> exceptions) {
return impl.createChild(INSTANCE.getOptionalTestChildRelationDefinition(), d, exceptions)
.getConfiguration();
}
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/client/ldap/AggregationClientTest.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/client/ldap/AggregationClientTest.java
index 5ddbf3a..7d07292 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/client/ldap/AggregationClientTest.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/client/ldap/AggregationClientTest.java
@@ -32,10 +32,9 @@
import java.util.TreeSet;
import org.forgerock.opendj.config.AdminTestCase;
-import org.forgerock.opendj.config.IllegalPropertyValueStringException;
+import org.forgerock.opendj.config.PropertyException;
import org.forgerock.opendj.config.LDAPProfile;
import org.forgerock.opendj.config.PropertyDefinitionsOptions;
-import org.forgerock.opendj.config.PropertyException;
import org.forgerock.opendj.config.TestCfg;
import org.forgerock.opendj.config.TestChildCfgClient;
import org.forgerock.opendj.config.TestChildCfgDefn;
@@ -248,11 +247,10 @@
Assert.assertEquals(causes.size(), 1);
Throwable cause = causes.iterator().next();
- if (cause instanceof IllegalPropertyValueStringException) {
- IllegalPropertyValueStringException pe = (IllegalPropertyValueStringException) cause;
+ if (cause instanceof PropertyException) {
+ PropertyException pe = (PropertyException) cause;
Assert.assertEquals(pe.getPropertyDefinition(), TestChildCfgDefn.getInstance()
.getAggregationPropertyPropertyDefinition());
- Assert.assertEquals(pe.getIllegalValueString(), "cn=LDAP Connection Handler, cn=bad rdn, cn=config");
} else {
// Got an unexpected cause.
throw e;
diff --git a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/server/AggregationServerTest.java b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/server/AggregationServerTest.java
index ba2116f..c6a7604 100644
--- a/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/server/AggregationServerTest.java
+++ b/opendj-sdk/opendj-config/src/test/java/org/forgerock/opendj/config/server/AggregationServerTest.java
@@ -42,9 +42,8 @@
import org.forgerock.opendj.config.AdminTestCase;
import org.forgerock.opendj.config.AdministratorAction;
import org.forgerock.opendj.config.AggregationPropertyDefinition;
-import org.forgerock.opendj.config.IllegalPropertyValueStringException;
-import org.forgerock.opendj.config.PropertyDefinitionsOptions;
import org.forgerock.opendj.config.PropertyException;
+import org.forgerock.opendj.config.PropertyDefinitionsOptions;
import org.forgerock.opendj.config.PropertyOption;
import org.forgerock.opendj.config.TestCfg;
import org.forgerock.opendj.config.TestChildCfg;
@@ -307,11 +306,9 @@
ServerManagedObjectDecodingException de = (ServerManagedObjectDecodingException) e.getCause();
assertThat(de.getCauses()).hasSize(1);
PropertyException propertyException = de.getCauses().iterator().next();
- assertThat(propertyException).isInstanceOf(IllegalPropertyValueStringException.class);
- IllegalPropertyValueStringException pe = (IllegalPropertyValueStringException) propertyException;
- assertEquals(pe.getPropertyDefinition(), TestChildCfgDefn.getInstance()
+ assertThat(propertyException).isInstanceOf(PropertyException.class);
+ assertEquals(propertyException.getPropertyDefinition(), TestChildCfgDefn.getInstance()
.getAggregationPropertyPropertyDefinition());
- assertEquals(pe.getIllegalValueString(), "cn=LDAP Connection Handler, cn=bad rdn, cn=config");
}
}
--
Gitblit v1.10.0