提交 a4ec60fa 编写于 作者: K khazra

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
上级 5c82c751
......@@ -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 + "'");
}
}
}
}
......
......@@ -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<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.
......
......@@ -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
############################################################################
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册