Rewrite FilePreferences
This commit is contained in:
parent
0d637a07f7
commit
a545c6d727
|
@ -29,7 +29,7 @@ public class FilePreferencesFactory implements PreferencesFactory {
|
||||||
try {
|
try {
|
||||||
node.sync();
|
node.sync();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.getLogger(FilePreferences.class.getName()).log(Level.WARNING, e, e::toString);
|
Logger.getLogger(FilePreferences.class.getName()).log(Level.WARNING, "Failed to load preferences: " + backingStoreFile, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// store preferences on exit
|
// store preferences on exit
|
||||||
|
@ -37,7 +37,7 @@ public class FilePreferencesFactory implements PreferencesFactory {
|
||||||
try {
|
try {
|
||||||
userRoot.flush();
|
userRoot.flush();
|
||||||
} catch (BackingStoreException e) {
|
} catch (BackingStoreException e) {
|
||||||
Logger.getLogger(FilePreferences.class.getName()).log(Level.WARNING, e, e::toString);
|
Logger.getLogger(FilePreferences.class.getName()).log(Level.WARNING, "Failed to save preferences: " + backingStoreFile, e);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -115,8 +115,8 @@ public class PropertyFileBackingStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flush() throws IOException {
|
public void flush() throws IOException {
|
||||||
StringWriter buffer = new StringWriter(1024);
|
StringWriter buffer = new StringWriter();
|
||||||
this.toProperties().store(buffer, null);
|
toProperties().store(buffer, null);
|
||||||
|
|
||||||
ByteBuffer data = UTF_8.encode(CharBuffer.wrap(buffer.getBuffer()));
|
ByteBuffer data = UTF_8.encode(CharBuffer.wrap(buffer.getBuffer()));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue