src/macosx/classes/java/util/prefs/MacOSXPreferences.java

Print this page

        

*** 71,110 **** } // Create a new root node. Called by getUserRoot() and getSystemRoot() // Synchronization is provided by the caller. ! private MacOSXPreferences(boolean newIsUser) ! { ! super(null, ""); ! isUser = newIsUser; ! isRoot = true; ! ! initFields(); } // Create a new non-root node with the given parent. // Called by childSpi(). ! private MacOSXPreferences(MacOSXPreferences parent, String name) ! { ! super(parent, name); ! isUser = isUserNode(); ! isRoot = false; ! ! initFields(); } ! private void initFields() { path = isRoot ? absolutePath() : absolutePath() + "/"; file = cfFileForNode(isUser); newNode = file.addNode(path); } - // Create and return the MacOSXPreferencesFile for this node. // Does not write anything to the file. private MacOSXPreferencesFile cfFileForNode(boolean isUser) { String name = path; --- 71,114 ---- } // Create a new root node. Called by getUserRoot() and getSystemRoot() // Synchronization is provided by the caller. ! private MacOSXPreferences(boolean newIsUser) { ! this(null, "", false, true, newIsUser); } // Create a new non-root node with the given parent. // Called by childSpi(). ! private MacOSXPreferences(MacOSXPreferences parent, String name) { ! this(parent, name, false, false, false); } + private MacOSXPreferences(MacOSXPreferences parent, String name, + boolean isNew) + { + this(parent, name, isNew, false, false); + } ! private MacOSXPreferences(MacOSXPreferences parent, String name, ! boolean isNew, boolean isRoot, boolean isUser) { + super(parent, name); + this.isRoot = isRoot; + if (isRoot) + this.isUser = isUser; + else + this.isUser = isUserNode(); path = isRoot ? absolutePath() : absolutePath() + "/"; file = cfFileForNode(isUser); + if (isNew) + newNode = isNew; + else newNode = file.addNode(path); } // Create and return the MacOSXPreferencesFile for this node. // Does not write anything to the file. private MacOSXPreferencesFile cfFileForNode(boolean isUser) { String name = path;
*** 202,213 **** protected AbstractPreferences childSpi(String name) { // Add to parent's child list here and disallow sync // because parent and child might be in different files. synchronized(MacOSXPreferencesFile.class) { ! file.addChildToNode(path, name); ! return new MacOSXPreferences(this, name); } } // AbstractPreferences override @Override --- 206,217 ---- protected AbstractPreferences childSpi(String name) { // Add to parent's child list here and disallow sync // because parent and child might be in different files. synchronized(MacOSXPreferencesFile.class) { ! boolean isNew = file.addChildToNode(path, name); ! return new MacOSXPreferences(this, name, isNew); } } // AbstractPreferences override @Override