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

System preferences

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.4.0
    • core-libs
    • x86
    • windows_2000



      Name: gm110360 Date: 08/28/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)


      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      When I saw the new preferences API added to J2SE 1.4,
      I was expecting its support in java.lang.System class also.

      Means that I expected that there is a method in System
      class which returns me all the System preferences as a
      Preferences object:
      public Preferences getPreferences();
      [along with the getProperties() method but intended to
      replace it [and also getProperties() may be deprecated] ]

      ALSO:
      I thought that the Preferences.systemRoot() returns me all
      system preferences [user.dir ...] same as
      System.getProperties();

      Please look into these suggestions.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.not applicable [suggestion]
      2.
      3.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      System.getPreferences() [new method] and
      Preferences.systemRoot() should give same values as
      System.getProperties()

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      no error message [suggestion]

      REPRODUCIBILITY :
      This bug can be reproduced rarely.

      ---------- BEGIN SOURCE ----------
      import java.util.prefs;
      //displays all system properties/preferences
      class PrefDemo
      {
          public static void main(String[] args) throws Exception
          {
              //Preferences prefs = Preferences.systemRoot();
              Preferences prefs = System.getPreferences();
              String[] cnames = prefs.keys();
              for (int i=0; i < cnames.length; i++)
              {
                  System.out.println(cnames[i]+" -> "+prefs.get(cnames[i], "nil"));
              }
          }
      }

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

      CUSTOMER WORKAROUND :
      get system properties and add them to the system root of
      the preferences object and return it in the
      System getPreferences() method
      (Review ID: 163697)
      ======================================================================

            jjb Josh Bloch (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: