User: juhalindfors
  Date: 02/03/08 07:32:03

  Modified:    src/main/javax/management/modelmbean DescriptorSupport.java
  Log:
  implements Serializable
  cleared up clone
  
  Revision  Changes    Path
  1.4       +13 -8     jmx/src/main/javax/management/modelmbean/DescriptorSupport.java
  
  Index: DescriptorSupport.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jmx/src/main/javax/management/modelmbean/DescriptorSupport.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DescriptorSupport.java    21 Feb 2002 06:38:37 -0000      1.3
  +++ DescriptorSupport.java    8 Mar 2002 15:32:03 -0000       1.4
  @@ -11,6 +11,8 @@
   import java.util.HashMap;
   import java.util.Collections;
   
  +import java.io.Serializable;
  +
   import javax.management.Descriptor;
   import javax.management.MBeanException;
   import javax.management.RuntimeOperationsException;
  @@ -22,10 +24,10 @@
    * @see javax.management.Descriptor
    *
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Juha Lindfors</a>.
  - * @version $Revision: 1.3 $  
  + * @version $Revision: 1.4 $  
    */
   public class DescriptorSupport
  -         implements Descriptor, Cloneable
  +         implements Descriptor, Cloneable, Serializable
   {
   
      // Attributes ----------------------------------------------------
  @@ -165,19 +167,22 @@
         }
      }
   
  -   public Object clone() throws RuntimeOperationsException
  +   public synchronized Object clone()
      {
         try
         {
  -         Descriptor descr = (Descriptor)super.clone();
  -         String[] fieldNames = this.getFieldNames();
  -         descr.setFields(fieldNames, this.getFieldValues(fieldNames));
  +         DescriptorSupport clone = (DescriptorSupport)super.clone();
  +      
  +         // FIXME: should we clone the value objects in fieldMap?
  +         clone.fieldMap  = Collections.synchronizedMap(new HashMap(this.fieldMap));
  +         clone.currClass = this.currClass;
   
  -         return descr;
  +         return clone;
         }
         catch (CloneNotSupportedException e)
         {
  -         throw new Error(e.toString());
  +         // Descriptor interface won't allow me to throw CNSE
  +         throw new RuntimeOperationsException(new RuntimeException(e.getMessage()), 
e.toString());
         }
      }
   
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to