From 73f7137bbadd359d5106cc5a69cdc3c9f5bedf0c Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Mon, 02 Dec 2013 13:04:03 +0000
Subject: [PATCH] Fix OPENDJ-1079: OpenDJ UpgradeCli adds HTTP connection handler, which breaks Tomcat6 when OpenDJ is an embeddedDS
---
opends/src/server/org/opends/server/admin/ClassPropertyDefinition.java | 43 +++++++++++++++++++++----------------------
1 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/opends/src/server/org/opends/server/admin/ClassPropertyDefinition.java b/opends/src/server/org/opends/server/admin/ClassPropertyDefinition.java
index adca10d..515681c 100644
--- a/opends/src/server/org/opends/server/admin/ClassPropertyDefinition.java
+++ b/opends/src/server/org/opends/server/admin/ClassPropertyDefinition.java
@@ -347,36 +347,35 @@
*/
private Class<?> validateClassInterfaces(String className, boolean initialize)
throws IllegalPropertyValueException {
- String nvalue = className.trim();
-
- Class<?> theClass;
- try {
- theClass = loadClass(nvalue, initialize);
- } catch (Throwable t) {
- // If the class cannot be loaded then it is an invalid value.
- throw new IllegalPropertyValueException(this, className, t);
- }
-
+ Class<?> theClass = loadClassForValidation(className, className,
+ initialize);
for (String i : instanceOfInterfaces) {
- try {
- Class<?> instanceOfClass = loadClass(i, initialize);
- if (!instanceOfClass.isAssignableFrom(theClass)) {
- throw new IllegalPropertyValueException(this, className);
- }
- } catch (Throwable t) {
- /*
- * Should not happen because the class was validated when the property
- * definition was constructed.
- */
- throw new IllegalPropertyValueException(this, className, t);
+ Class<?> instanceOfClass = loadClassForValidation(className, i,
+ initialize);
+ if (!instanceOfClass.isAssignableFrom(theClass)) {
+ throw new IllegalPropertyValueException(this, className);
}
}
-
return theClass;
}
+ private Class<?> loadClassForValidation(String componentClassName,
+ String classToBeLoaded, boolean initialize) {
+ try {
+ 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);
+ } catch (LinkageError e) {
+ // If the class cannot be initialized then it is an invalid value.
+ throw new IllegalPropertyValueException(this, componentClassName, e);
+ }
+ }
+
+
+
/*
* Do some basic checks to make sure the string representation is valid.
*/
--
Gitblit v1.10.0