From d46701cdbecec6f6c10f57432f3e6a484752f42c Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Sat, 18 Jan 2014 00:55:24 +0000
Subject: [PATCH] Simplify config framework exception hierarchy by removing and pulling up the following exceptions:
---
opendj3-server-dev/src/server/org/opends/server/admin/ClassPropertyDefinition.java | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/ClassPropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/ClassPropertyDefinition.java
index 41aa111..2324ff3 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/ClassPropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/ClassPropertyDefinition.java
@@ -30,6 +30,7 @@
import static org.forgerock.util.Reject.ifNull;
+import static org.opends.server.admin.PropertyException.*;
import java.util.Collections;
import java.util.EnumSet;
@@ -244,13 +245,13 @@
*/
@Override
public String decodeValue(String value)
- throws IllegalPropertyValueStringException {
+ throws PropertyException {
ifNull(value);
try {
validateValue(value);
- } catch (IllegalPropertyValueException e) {
- throw new IllegalPropertyValueStringException(this, value, e.getCause());
+ } catch (PropertyException e) {
+ throw illegalPropertyValueException(this, value, e.getCause());
}
return value;
@@ -283,7 +284,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
@@ -291,7 +292,7 @@
* requested type.
*/
public <T> Class<? extends T> loadClass(String className,
- Class<T> instanceOf) throws IllegalPropertyValueException,
+ Class<T> instanceOf) throws PropertyException,
ClassCastException {
ifNull(className, instanceOf);
@@ -310,7 +311,7 @@
*/
@Override
public String normalizeValue(String value)
- throws IllegalPropertyValueException {
+ throws PropertyException {
ifNull(value);
return value.trim();
@@ -323,7 +324,7 @@
*/
@Override
public void validateValue(String value)
- throws IllegalPropertyValueException {
+ throws PropertyException {
ifNull(value);
// Always make sure the name is a valid class name.
@@ -345,14 +346,14 @@
* definition.
*/
private Class<?> validateClassInterfaces(String className, boolean initialize)
- throws IllegalPropertyValueException {
+ throws PropertyException {
Class<?> theClass = loadClassForValidation(className, className,
initialize);
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;
@@ -366,10 +367,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 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 illegalPropertyValueException(this, componentClassName, e);
}
}
@@ -379,10 +380,10 @@
* Do some basic checks to make sure the string representation is valid.
*/
private void validateClassName(String className)
- throws IllegalPropertyValueException {
+ throws PropertyException {
String nvalue = className.trim();
if (!nvalue.matches(CLASS_RE)) {
- throw new IllegalPropertyValueException(this, className);
+ throw PropertyException.illegalPropertyValueException(this, className);
}
}
}
--
Gitblit v1.10.0