7184287: (prefs) BackingStoreException when calling flush on root node[macosx]
Summary: Change implementation to enable user without administrative privileges to call flush
Reviewed-by: alanb
--- a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferences.java Tue Jul 24 12:17:39 2012 -0700
+++ b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferences.java Tue Jul 24 13:38:50 2012 -0700
@@ -221,9 +221,14 @@
// 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 + "'");
+ }
}
}
}
--- a/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java Tue Jul 24 12:17:39 2012 -0700
+++ b/jdk/src/macosx/classes/java/util/prefs/MacOSXPreferencesFile.java Tue Jul 24 13:38:50 2012 -0700
@@ -233,7 +233,23 @@
return ok;
}
-
+ //Flush only current user preferences
+ static synchronized boolean flushUser() {
+ boolean ok = true;
+ if (changedFiles != null && !changedFiles.isEmpty()) {
+ Iterator<MacOSXPreferencesFile> 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.
--- a/jdk/test/ProblemList.txt Tue Jul 24 12:17:39 2012 -0700
+++ b/jdk/test/ProblemList.txt Tue Jul 24 13:38:50 2012 -0700
@@ -384,8 +384,4 @@
# 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
-
############################################################################