diff --git a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferences.java b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferences.java index a4ec19a6803..42c61009d11 100644 --- a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferences.java +++ b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferences.java @@ -221,9 +221,14 @@ class MacOSXPreferences extends AbstractPreferences { // Flush should *not* check for removal, unlike sync, but should // prevent simultaneous removal. synchronized(lock) { - // fixme! overkill - if (!MacOSXPreferencesFile.flushWorld()) { - throw new BackingStoreException("Synchronization failed for node '" + path + "'"); + if (isUser) { + if (!MacOSXPreferencesFile.flushUser()) { + throw new BackingStoreException("Synchronization failed for node '" + path + "'"); + } + } else { + if (!MacOSXPreferencesFile.flushWorld()) { + throw new BackingStoreException("Synchronization failed for node '" + path + "'"); + } } } } diff --git a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java index e27ac0f1532..ee9b652dfc8 100644 --- a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java +++ b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java @@ -233,7 +233,23 @@ class MacOSXPreferencesFile { return ok; } - + //Flush only current user preferences + static synchronized boolean flushUser() { + boolean ok = true; + if (changedFiles != null && !changedFiles.isEmpty()) { + Iterator iterator = changedFiles.iterator(); + while(iterator.hasNext()) { + MacOSXPreferencesFile f = iterator.next(); + if (f.user == cfCurrentUser) { + if (!f.synchronize()) + ok = false; + else + iterator.remove(); + } + } + } + return ok; + } // Write all prefs changes to disk, but do not clear all cached prefs // values. Also kills any scheduled flush task. diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 0e694834028..fa314010413 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -384,8 +384,4 @@ java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all # 7041639, Solaris DSA keypair generation bug java/util/TimeZone/TimeZoneDatePermissionCheck.sh solaris-all -# 7150557 -java/util/prefs/RemoveReadOnlyNode.java macosx-all -java/util/prefs/RemoveUnregedListener.java macosx-all - ############################################################################