From a545c6d7271b39a5c5fb28f91c4cbb0b561573d1 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 23 Oct 2016 05:21:12 +0800 Subject: [PATCH] Rewrite FilePreferences --- source/net/filebot/util/prefs/FilePreferencesFactory.java | 4 ++-- source/net/filebot/util/prefs/PropertyFileBackingStore.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/net/filebot/util/prefs/FilePreferencesFactory.java b/source/net/filebot/util/prefs/FilePreferencesFactory.java index 7ac5e29d..7d0ddd9c 100644 --- a/source/net/filebot/util/prefs/FilePreferencesFactory.java +++ b/source/net/filebot/util/prefs/FilePreferencesFactory.java @@ -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); } })); diff --git a/source/net/filebot/util/prefs/PropertyFileBackingStore.java b/source/net/filebot/util/prefs/PropertyFileBackingStore.java index 598f76cf..7bd672c7 100644 --- a/source/net/filebot/util/prefs/PropertyFileBackingStore.java +++ b/source/net/filebot/util/prefs/PropertyFileBackingStore.java @@ -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()));