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

(prefs) Access to default PreferencesFactory to use when customizing Preferences

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P5
    • Resolution: Unresolved
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Understanding:
      Fix Understood
    • CPU:
      x86
    • OS:
      windows_2000

      Description

      Name: jl125535 Date: 05/22/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)

      A DESCRIPTION OF THE PROBLEM :
      When Customizing Preferences in the proper way:
      extending AbstractPreferences, and setting
      java.util.prefs.PreferencesFactory to point to the newly
      created PreferencesFactory, a workaround is currently
      required to implement the new Preferences backed by the
      default preferences. All the new preferences want to do is
      customize things (for example allowing preferences for
      multiple users), and use the default Preferences to do the
      persistence (e.g. WindowsPreferences on a Windows Platform).

      The problem is that there is no easy way of accessing the
      default preferences factory.

      I propose an extra method such as:
      public static PreferencesFactory
      getDefaultPreferencesFactory() which would return the
      WindowsPreferencesFactory on Windows, not the customized one
      specified by java.util.prefs.PreferencesFactory.



      This bug can be reproduced always.

      CUSTOMER WORKAROUND :
      create an extra setting for
      java.util.prefs.DefaultPreferencesFactory
      then:

      Constructor constructor =
      Class.forName(System.getProperty("java.util.prefs.DefaultPreferencesFactory")).getDeclaredConstructor(null);
      constructor.setAccessible(true);
      PreferencesFactory defaultPreferencesFactory =
      (PreferencesFactory)constructor.newInstance(null);
      (Review ID: 146884)
      ======================================================================
      ###@###.### 11/3/04 20:34 GMT

        Attachments

          Activity

            People

            • Assignee:
              sherman Xueming Shen
              Reporter:
              jleesunw Jon Lee (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: