admin@glassfish.java.net

CODE REVIEW: 3331: "Exception thrown when deleting JMS dest thru GUI for non-DAS config"

From: Lloyd L Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Fri, 13 Jul 2007 17:17:51 -0700

TIMEOUT: 16:00 PST Monday July 16, 2007

This fixes bug:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=3331

See comment below for explanation.


Index: src/java/com/sun/appserv/management/helper/RefHelper.java
===================================================================
RCS file: /cvs/glassfish/appserv-api/src/java/com/sun/appserv/
management/helper/RefHelper.java,v
retrieving revision 1.3
diff -w -u -r1.3 RefHelper.java
--- src/java/com/sun/appserv/management/helper/RefHelper.java 5 May
2007 05:30:50 -0000 1.3
+++ src/java/com/sun/appserv/management/helper/RefHelper.java 14
Jul 2007 00:15:54 -0000
@@ -52,6 +52,7 @@
import com.sun.appserv.management.base.XTypes;
import com.sun.appserv.management.base.QueryMgr;
import com.sun.appserv.management.base.Util;
+import com.sun.appserv.management.base.Extra;
import com.sun.appserv.management.util.misc.CollectionUtil;
import com.sun.appserv.management.util.misc.GSetUtil;
@@ -352,6 +353,14 @@

          for( final T ref : refs )
          {
+ /* while deleting references, certain ones, such as
those contained
+ within a cluster, implicitly delete other (redundant)
references
+ eg references by clustered servers. Verify that a
reference still
+ exists before attempting to delete it.
+ */
+ final Extra extra = Util.getExtra( ref );
+ if ( extra.checkValid() )
+ {
              final ConfigRemover rrc = ConfigRemover.class.cast
( ref.getContainer() );

              try
@@ -364,6 +373,7 @@
                  failures.add( ref );
              }
          }
+ }

          return failures;
      }