Avoid premature declaration of variables

Closes gh-15215
pull/15385/head
dreis2211 6 years ago committed by Stephane Nicoll
parent 6d2a91ed83
commit f57f16c190

@ -91,12 +91,12 @@ class CloudFoundryWebEndpointServletHandlerMapping
}
AccessLevel accessLevel = (AccessLevel) request
.getAttribute(AccessLevel.REQUEST_ATTRIBUTE);
Map<String, Link> links = CloudFoundryWebEndpointServletHandlerMapping.this.linksResolver
.resolveLinks(request.getRequestURL().toString());
Map<String, Link> filteredLinks = new LinkedHashMap<>();
if (accessLevel == null) {
return Collections.singletonMap("_links", filteredLinks);
}
Map<String, Link> links = CloudFoundryWebEndpointServletHandlerMapping.this.linksResolver
.resolveLinks(request.getRequestURL().toString());
filteredLinks = links.entrySet().stream()
.filter((e) -> e.getKey().equals("self")
|| accessLevel.isAccessAllowed(e.getKey()))

@ -42,11 +42,11 @@ public enum ManagementPortType {
DIFFERENT;
static ManagementPortType get(Environment environment) {
Integer serverPort = getPortProperty(environment, "server.");
Integer managementPort = getPortProperty(environment, "management.server.");
if (managementPort != null && managementPort < 0) {
return DISABLED;
}
Integer serverPort = getPortProperty(environment, "server.");
return ((managementPort == null
|| (serverPort == null && managementPort.equals(8080))
|| (managementPort != 0 && managementPort.equals(serverPort))) ? SAME

@ -120,7 +120,6 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
if (skip == SkipPropertyMapping.YES) {
return;
}
String name = getName(typeMapping, attributeMapping, attribute);
ReflectionUtils.makeAccessible(attribute);
Object value = ReflectionUtils.invokeMethod(attribute, annotation);
if (skip == SkipPropertyMapping.ON_DEFAULT_VALUE) {
@ -130,6 +129,7 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
return;
}
}
String name = getName(typeMapping, attributeMapping, attribute);
putProperties(name, value, properties);
}

@ -242,12 +242,12 @@ final class BindConverter {
}
private PropertyEditor getPropertyEditor(Class<?> type) {
SimpleTypeConverter typeConverter = this.typeConverter;
if (type == null || type == Object.class
|| Collection.class.isAssignableFrom(type)
|| Map.class.isAssignableFrom(type)) {
return null;
}
SimpleTypeConverter typeConverter = this.typeConverter;
PropertyEditor editor = typeConverter.getDefaultEditor(type);
if (editor == null) {
editor = typeConverter.findCustomEditor(type, null);

Loading…
Cancel
Save