Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6613858

ObjectName Constructor declaration breaks Properties() argument in 1.6

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • None
    • 6
    • core-svc

      FULL PRODUCT VERSION :
      # java -version
      java version "1.5.0_12"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
      Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      # uname -a
      Linux dev199.shsolutions.com 2.6.18-1.2798.fc6 #1 SMP Mon Oct 16 14:37:32 EDT 2006 i686 i686 i386 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :


      B/c the constructor definition for ObjectName changed from 1.5 to 1.6

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      import java.util.Hashtable;
      import java.util.Properties;

      import javax.management.ObjectName;
      import javax.management.MalformedObjectNameException;


      /**
       * Hello world!
       *
       */
      public class App
      {
      public String value = "hi";
      public ObjectName objectName;
      public Hashtable<String,String> props;
      public Properties properties;

      public App() {
      }

          public static void main( String[] args ) throws MalformedObjectNameException
          {
      App app = new App();

      app.props = new Hashtable<String,String>();
      app.props.put("11","22");

      app.properties = new Properties();

      app.properties.setProperty("1","a");
      app.properties.setProperty("2","b");

      app.objectName = new ObjectName("string name", app.properties);
              System.out.println( "Hello World! : " + app.value );
              System.out.println( "ObjectName is : " + app.objectName );
          }
      }


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Hello World! : hi
      ObjectName is : string name:2=b,1=a
      ACTUAL -
      Cannot even compile....



      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      [INFO] Compilation failure
      App.java:[36,22] cannot find symbol
      symbol : constructor ObjectName(java.lang.String,java.util.Properties)
      location: class javax.management.ObjectName


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.Hashtable;
      import java.util.Properties;

      import javax.management.ObjectName;
      import javax.management.MalformedObjectNameException;


      /**
       * Hello world!
       *
       */
      public class App
      {
      public String value = "hi";
      public ObjectName objectName;
      public Hashtable<String,String> props;
      public Properties properties;

      public App() {
      }

          public static void main( String[] args ) throws MalformedObjectNameException
          {
      App app = new App();

      app.props = new Hashtable<String,String>();
      app.props.put("11","22");

      app.properties = new Properties();

      app.properties.setProperty("1","a");
      app.properties.setProperty("2","b");

                   // The line below compiles in 1.5 but not in 1.6
      app.objectName = new ObjectName("string name", app.properties);
              System.out.println( "Hello World! : " + app.value );
              System.out.println( "ObjectName is : " + app.objectName );
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      no work around

      Release Regression From : 5.0u12
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

      Release Regression From : 5.0u12
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            emcmanus Eamonn McManus
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: