Gary Benson wrote:
> This commit ensures that javax.management.ObjectName.properties is
> always initialized.  Without it there are at least two possible ways
> to create an ObjectName with a null properties field.

This commit.

Cheers,
Gary
Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.9119
diff -u -r1.9119 ChangeLog
--- ChangeLog   19 Feb 2007 09:27:43 -0000      1.9119
+++ ChangeLog   19 Feb 2007 13:58:07 -0000
@@ -1,3 +1,10 @@
+2007-02-19  Gary Benson  <[EMAIL PROTECTED]>
+
+       * javax/management/ObjectName.java
+       (properties): Initialize when declared.
+       (ObjectName(String)): Don't initialize properties here.
+       (ObjectName(String, String, String): Likewise.
+
 2007-02-19  Chris Burdess  <[EMAIL PROTECTED]>
 
        Fixes #30831
Index: javax/management/ObjectName.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/management/ObjectName.java,v
retrieving revision 1.6
diff -u -r1.6 ObjectName.java
--- javax/management/ObjectName.java    19 Feb 2007 01:34:58 -0000      1.6
+++ javax/management/ObjectName.java    19 Feb 2007 13:58:07 -0000
@@ -105,7 +105,7 @@
   /**
    * The properties, as key-value pairs.
    */
-  private TreeMap<String,String> properties;
+  private TreeMap<String,String> properties = new TreeMap<String,String>();
 
   /**
    * The properties as a string (stored for ordering).
@@ -164,7 +164,6 @@
          throw new MalformedObjectNameException("A name that is not a " +
                                                 "pattern must contain at " +
                                                 "least one key-value pair.");
-       properties = new TreeMap<String,String>();
        for (int a = 0; a < pairs.length; ++a)
          {
            int sep = pairs[a].indexOf('=');
@@ -197,7 +196,6 @@
     throws MalformedObjectNameException
   {
     this.domain = domain;
-    properties = new TreeMap<String,String>();
     properties.put(key, value);
     checkComponents();
   }

Reply via email to