From 45d74a617ec7e631da286648024bc84fad984479 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Wed, 19 Sep 2007 22:58:07 +0000
Subject: [PATCH] - Use runtime casts and casted instanceof to workaround related bugs in JDK versions prior to 1.5.0_08.   These changes were ok'ed by Matt on condition that once Mac users have fixed JDK release i agree to   track and remove all that "just plain ugly" stuff.

---
 opends/src/server/org/opends/server/admin/AbstractManagedObjectDefinition.java   |    4 +++-
 opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java |    4 +++-
 opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java  |    4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/opends/src/server/org/opends/server/admin/AbstractManagedObjectDefinition.java b/opends/src/server/org/opends/server/admin/AbstractManagedObjectDefinition.java
index 960ff99..0f3b9e3 100644
--- a/opends/src/server/org/opends/server/admin/AbstractManagedObjectDefinition.java
+++ b/opends/src/server/org/opends/server/admin/AbstractManagedObjectDefinition.java
@@ -667,7 +667,9 @@
    *         definition is the {@link TopCfgDefn}.
    */
   public final boolean isTop() {
-    return (this == TopCfgDefn.getInstance());
+    // Casting to Object and instanceof check are required
+    // to workaround a bug in JDK versions prior to 1.5.0_08.
+    return ((Object) this instanceof TopCfgDefn);
   }
 
 
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java b/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
index fb0a0d7..1671991 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
@@ -456,8 +456,10 @@
 
     for (PropertyDefinition<?> pd : d.getAllPropertyDefinitions()) {
       if (pd instanceof AggregationPropertyDefinition) {
+        // Runtime cast is required to workaround a
+        // bug in JDK versions prior to 1.5.0_08.
         AggregationPropertyDefinition<?, ?> apd =
-          (AggregationPropertyDefinition<?, ?>) pd;
+          AggregationPropertyDefinition.class.cast(pd);
 
         // Skip this aggregation if it doesn't have an enable
         // property.
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java b/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
index 73e5b43..c800122 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
@@ -342,8 +342,10 @@
 
     for (PropertyDefinition<?> pd : d.getAllPropertyDefinitions()) {
       if (pd instanceof AggregationPropertyDefinition) {
+        // Runtime cast is required to workaround a
+        // bug in JDK versions prior to 1.5.0_08.
         AggregationPropertyDefinition<?, ?> apd =
-          (AggregationPropertyDefinition<?, ?>) pd;
+          AggregationPropertyDefinition.class.cast(pd);
 
         // Skip this aggregation if it doesn't have an enable
         // property.

--
Gitblit v1.10.0