Change method signature

This commit is contained in:
mposolda committed 2014-10-05 20:07:54 +02:00
1 parent e01424b815
commit 59bf7e524f
3 files changed
+9 -6

No files matched your search

@@ -47,11 +47,15 @@ public class JsonSerialization {
} }
public static <T> T readValue(InputStream bytes, Class<T> type) throws IOException { public static <T> T readValue(InputStream bytes, Class<T> type) throws IOException {
return mapper.readValue(bytes, type); return readValue(bytes, type, false);
} }
public static <T> T readValueAndReplaceSysProperties(InputStream bytes, Class<T> type) throws IOException { public static <T> T readValue(InputStream bytes, Class<T> type, boolean replaceSystemProperties) throws IOException {
return sysPropertiesAwareMapper.readValue(bytes, type); if (replaceSystemProperties) {
return sysPropertiesAwareMapper.readValue(bytes, type);
} else {
return mapper.readValue(bytes, type);
}
} }
@@ -21,7 +21,7 @@ public class JsonParserTest {
InputStream is = getClass().getClassLoader().getResourceAsStream("keycloak.json"); 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("http://foo:8080/auth", config.getAuthServerUrl());
Assert.assertEquals("external", config.getSslRequired()); Assert.assertEquals("external", config.getSslRequired());
Assert.assertEquals("angular-product${non.existing}", config.getResource()); Assert.assertEquals("angular-product${non.existing}", config.getResource());
@@ -7,7 +7,6 @@ import org.keycloak.enums.RelativeUrlsUsed;
import org.keycloak.representations.adapters.config.AdapterConfig; import org.keycloak.representations.adapters.config.AdapterConfig;
import org.keycloak.util.JsonSerialization; import org.keycloak.util.JsonSerialization;
import org.keycloak.util.KeycloakUriBuilder; import org.keycloak.util.KeycloakUriBuilder;
import org.keycloak.util.UriUtils;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@@ -25,7 +24,7 @@ public class ServletOAuthClientBuilder {
public static AdapterConfig getAdapterConfig(InputStream is) { public static AdapterConfig getAdapterConfig(InputStream is) {
try { try {
return JsonSerialization.readValueAndReplaceSysProperties(is, AdapterConfig.class); return JsonSerialization.readValue(is, AdapterConfig.class, true);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }