Guard for when result.getPropertySources() is null.

fixes gh-488
This commit is contained in:
Spencer Gibb
2016-08-25 11:29:32 -06:00
parent 91c8490120
commit 2c726b2c4b

View File

@@ -85,12 +85,14 @@ public class ConfigServicePropertySourceLocator implements PropertySourceLocator
result.getProfiles() == null ? "" : Arrays.asList(result.getProfiles()),
result.getLabel(), result.getVersion()));
for (PropertySource source : result.getPropertySources()) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) source
.getSource();
composite.addPropertySource(new MapPropertySource(source
.getName(), map));
if (result.getPropertySources() != null) { // result.getPropertySources() can be null if using xml
for (PropertySource source : result.getPropertySources()) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) source
.getSource();
composite.addPropertySource(new MapPropertySource(source
.getName(), map));
}
}
return composite;
}