diff --git a/content-core/src/main/java/org/xbib/content/settings/PropertiesSettingsLoader.java b/content-core/src/main/java/org/xbib/content/settings/PropertiesSettingsLoader.java index afa0b18..c93aa27 100644 --- a/content-core/src/main/java/org/xbib/content/settings/PropertiesSettingsLoader.java +++ b/content-core/src/main/java/org/xbib/content/settings/PropertiesSettingsLoader.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; +import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -40,7 +41,7 @@ public class PropertiesSettingsLoader implements SettingsLoader { @Override public Map load(BytesReference ref) throws IOException { Properties props = new Properties(); - try (Reader reader = new InputStreamReader(ref.streamInput())) { + try (Reader reader = new InputStreamReader(ref.streamInput(), StandardCharsets.UTF_8)) { props.load(reader); Map result = new HashMap<>(); for (Map.Entry entry : props.entrySet()) { diff --git a/content-core/src/test/java/org/xbib/content/settings/SettingsTest.java b/content-core/src/test/java/org/xbib/content/settings/SettingsTest.java index 6df296b..f5cfa7e 100644 --- a/content-core/src/test/java/org/xbib/content/settings/SettingsTest.java +++ b/content-core/src/test/java/org/xbib/content/settings/SettingsTest.java @@ -2,6 +2,7 @@ package org.xbib.content.settings; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; import org.xbib.content.XContentHelper; @@ -180,10 +181,12 @@ public class SettingsTest { @Test public void testRefresher() throws Exception { Settings settings = Settings.settingsBuilder() - .setRefresh(Paths.get("src/test/resources/settings.json"), 0L, 1L, TimeUnit.DAYS) + .put("name", "hello") + .setRefresh(Paths.get("src/test/resources/settings.json"), 1L, 1L, TimeUnit.SECONDS) .build(); - Thread.sleep(1000L); - assertEquals("Jörg Prante", settings.get("name")); + assertEquals("hello", settings.get("name")); + Thread.sleep(2000L); + assertEquals("world", settings.get("name")); settings.close(); } } diff --git a/content-core/src/test/resources/settings.json b/content-core/src/test/resources/settings.json index 8b412ed..7e183a7 100644 --- a/content-core/src/test/resources/settings.json +++ b/content-core/src/test/resources/settings.json @@ -1,3 +1,3 @@ { - "name": "Jörg Prante" + "name": "world" } diff --git a/gradle.properties b/gradle.properties index 3b893ff..1aa110a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ group = org.xbib name = content -version = 2.3.1 +version = 2.3.2 gradle.wrapper.version = 6.4.1 xbib.net.version = 2.1.0 -jackson.version = 2.11.0 -jackson.databind.version = 2.11.0 +jackson.version = 2.11.1 +jackson.databind.version = 2.11.1 woodstox.version = 6.2.1 snakeyaml.version = 1.26 mockito.version = 3.3.3