Rewrite FilePreferences

This commit is contained in:
Reinhard Pointner 2016-10-23 05:21:12 +08:00
parent 0d637a07f7
commit a545c6d727
2 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ public class FilePreferencesFactory implements PreferencesFactory {
try {
node.sync();
} 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
@ -37,7 +37,7 @@ public class FilePreferencesFactory implements PreferencesFactory {
try {
userRoot.flush();
} 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);
}
}));

View File

@ -115,8 +115,8 @@ public class PropertyFileBackingStore {
}
public void flush() throws IOException {
StringWriter buffer = new StringWriter(1024);
this.toProperties().store(buffer, null);
StringWriter buffer = new StringWriter();
toProperties().store(buffer, null);
ByteBuffer data = UTF_8.encode(CharBuffer.wrap(buffer.getBuffer()));