diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/EnvironmentController.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/EnvironmentController.java index f5d20db1..7d040c33 100644 --- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/EnvironmentController.java +++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/EnvironmentController.java @@ -15,9 +15,6 @@ */ package org.springframework.cloud.config.server.environment; -import static org.springframework.cloud.config.server.support.EnvironmentPropertySource.prepareEnvironment; -import static org.springframework.cloud.config.server.support.EnvironmentPropertySource.resolvePlaceholders; - import java.io.IOException; import java.util.ArrayList; import java.util.Collection; @@ -31,6 +28,12 @@ import java.util.TreeMap; import javax.servlet.http.HttpServletResponse; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.yaml.snakeyaml.DumperOptions.FlowStyle; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.nodes.Tag; + import org.springframework.cloud.config.environment.Environment; import org.springframework.cloud.config.environment.PropertySource; import org.springframework.http.HttpHeaders; @@ -42,13 +45,10 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; -import org.yaml.snakeyaml.DumperOptions.FlowStyle; -import org.yaml.snakeyaml.Yaml; -import org.yaml.snakeyaml.nodes.Tag; -import com.fasterxml.jackson.databind.ObjectMapper; +import static org.springframework.cloud.config.server.support.EnvironmentPropertySource.prepareEnvironment; +import static org.springframework.cloud.config.server.support.EnvironmentPropertySource.resolvePlaceholders; /** * @author Dave Syer @@ -345,6 +345,7 @@ public class EnvironmentController { private void setMapValue(Map map, Object value) { String key = getKey(); if (NodeType.MAP.equals(valueType)) { + @SuppressWarnings("unchecked") Map nestedMap = (Map) map.get(key); if (nestedMap == null) { nestedMap = new LinkedHashMap<>(); @@ -352,6 +353,7 @@ public class EnvironmentController { } setMapValue(nestedMap, value); } else if (NodeType.ARRAY.equals(valueType)) { + @SuppressWarnings("unchecked") List list = (List) map.get(key); if (list == null) { list = new ArrayList<>(); @@ -370,6 +372,7 @@ public class EnvironmentController { list.add(null); } if (NodeType.MAP.equals(valueType)) { + @SuppressWarnings("unchecked") Map map = (Map) list.get(index); if (map == null) { map = new LinkedHashMap<>(); @@ -377,6 +380,7 @@ public class EnvironmentController { } setMapValue(map, value); } else if (NodeType.ARRAY.equals(valueType)) { + @SuppressWarnings("unchecked") List nestedList = (List) list.get(index); if (nestedList == null) { nestedList = new ArrayList<>(); diff --git a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/SubversionConfigServerIntegrationTests.java b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/SubversionConfigServerIntegrationTests.java index ded506ec..c9736ba0 100644 --- a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/SubversionConfigServerIntegrationTests.java +++ b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/SubversionConfigServerIntegrationTests.java @@ -44,10 +44,10 @@ import static org.springframework.cloud.config.server.test.ConfigServerTestUtils * @author Roy Clarkson */ @RunWith(SpringRunner.class) -@SpringBootTest(classes = ConfigServerApplication.class, - properties = { "spring.config.name:configserver", - "spring.cloud.config.server.svn.uri:file:///./target/repos/svn-config-repo" }, - webEnvironment = RANDOM_PORT) +@SpringBootTest(classes = ConfigServerApplication.class, properties = { + "spring.config.name:configserver", + "spring.cloud.config.server.svn.uri:file:///./target/repos/svn-config-repo", + "logging.level.org.springframework.cloud=DEBUG" }, webEnvironment = RANDOM_PORT) @ActiveProfiles("subversion") public class SubversionConfigServerIntegrationTests { @@ -65,12 +65,12 @@ public class SubversionConfigServerIntegrationTests { @Test public void contextLoads() { - Environment environment = new TestRestTemplate().getForObject("http://localhost:" - + this.port + "/foo/development/", Environment.class); + Environment environment = new TestRestTemplate().getForObject( + "http://localhost:" + this.port + "/foo/development/", Environment.class); assertFalse(environment.getPropertySources().isEmpty()); assertEquals("overrides", environment.getPropertySources().get(0).getName()); - assertEquals("{spring.cloud.config.enabled=true}", environment - .getPropertySources().get(0).getSource().toString()); + assertEquals("{spring.cloud.config.enabled=true}", + environment.getPropertySources().get(0).getSource().toString()); } @Test