From 59bf7e524f647ca6113765c05a8fe50734d63e00 Mon Sep 17 00:00:00 2001 From: mposolda Date: Sun, 5 Oct 2014 20:07:54 +0200 Subject: [PATCH] Change method signature --- .../main/java/org/keycloak/util/JsonSerialization.java | 10 +++++++--- core/src/test/java/org/keycloak/JsonParserTest.java | 2 +- .../keycloak/servlet/ServletOAuthClientBuilder.java | 3 +-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/keycloak/util/JsonSerialization.java b/core/src/main/java/org/keycloak/util/JsonSerialization.java index 0575e13f8c..49a4502f27 100755 --- a/core/src/main/java/org/keycloak/util/JsonSerialization.java +++ b/core/src/main/java/org/keycloak/util/JsonSerialization.java @@ -47,11 +47,15 @@ public class JsonSerialization { } public static T readValue(InputStream bytes, Class type) throws IOException { - return mapper.readValue(bytes, type); + return readValue(bytes, type, false); } - public static T readValueAndReplaceSysProperties(InputStream bytes, Class type) throws IOException { - return sysPropertiesAwareMapper.readValue(bytes, type); + public static T readValue(InputStream bytes, Class type, boolean replaceSystemProperties) throws IOException { + if (replaceSystemProperties) { + return sysPropertiesAwareMapper.readValue(bytes, type); + } else { + return mapper.readValue(bytes, type); + } } diff --git a/core/src/test/java/org/keycloak/JsonParserTest.java b/core/src/test/java/org/keycloak/JsonParserTest.java index 8cdbd41d0f..265b401414 100644 --- a/core/src/test/java/org/keycloak/JsonParserTest.java +++ b/core/src/test/java/org/keycloak/JsonParserTest.java @@ -21,7 +21,7 @@ public class JsonParserTest { InputStream is = getClass().getClassLoader().getResourceAsStream("keycloak.json"); - AdapterConfig config = JsonSerialization.readValueAndReplaceSysProperties(is, AdapterConfig.class); + AdapterConfig config = JsonSerialization.readValue(is, AdapterConfig.class, true); Assert.assertEquals("http://foo:8080/auth", config.getAuthServerUrl()); Assert.assertEquals("external", config.getSslRequired()); Assert.assertEquals("angular-product${non.existing}", config.getResource()); diff --git a/integration/servlet-oauth-client/src/main/java/org/keycloak/servlet/ServletOAuthClientBuilder.java b/integration/servlet-oauth-client/src/main/java/org/keycloak/servlet/ServletOAuthClientBuilder.java index ba4135697b..e9013fd726 100755 --- a/integration/servlet-oauth-client/src/main/java/org/keycloak/servlet/ServletOAuthClientBuilder.java +++ b/integration/servlet-oauth-client/src/main/java/org/keycloak/servlet/ServletOAuthClientBuilder.java @@ -7,7 +7,6 @@ import org.keycloak.enums.RelativeUrlsUsed; import org.keycloak.representations.adapters.config.AdapterConfig; import org.keycloak.util.JsonSerialization; import org.keycloak.util.KeycloakUriBuilder; -import org.keycloak.util.UriUtils; import java.io.IOException; import java.io.InputStream; @@ -25,7 +24,7 @@ public class ServletOAuthClientBuilder { public static AdapterConfig getAdapterConfig(InputStream is) { try { - return JsonSerialization.readValueAndReplaceSysProperties(is, AdapterConfig.class); + return JsonSerialization.readValue(is, AdapterConfig.class, true); } catch (IOException e) { throw new RuntimeException(e); }