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 { 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);
} }
})); }));

View File

@ -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()));