Browse Source

Polish

See gh-18736
pull/18811/head
mattisonchao 7 years ago committed by Stephane Nicoll
parent
commit
f61da8b723
  1. 2
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/http/ApiVersion.java
  2. 4
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMappedEndpoints.java
  3. 7
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java

2
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/http/ApiVersion.java

@ -75,7 +75,7 @@ public enum ApiVersion { @@ -75,7 +75,7 @@ public enum ApiVersion {
try {
return valueOf(type.toUpperCase());
}
catch (IllegalArgumentException ex) {
catch (IllegalArgumentException ignored) {
}
}
return null;

4
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMappedEndpoints.java

@ -65,13 +65,13 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> { @@ -65,13 +65,13 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
private Map<EndpointId, PathMappedEndpoint> getEndpoints(Collection<EndpointsSupplier<?>> suppliers) {
Map<EndpointId, PathMappedEndpoint> endpoints = new LinkedHashMap<>();
suppliers.forEach((supplier) -> {
for (EndpointsSupplier<?> supplier : suppliers) {
supplier.getEndpoints().forEach((endpoint) -> {
if (endpoint instanceof PathMappedEndpoint) {
endpoints.put(endpoint.getEndpointId(), (PathMappedEndpoint) endpoint);
}
});
});
}
return Collections.unmodifiableMap(endpoints);
}

7
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapper.java

@ -100,11 +100,8 @@ public class HealthWebEndpointResponseMapper { @@ -100,11 +100,8 @@ public class HealthWebEndpointResponseMapper {
}
private boolean canSeeDetails(SecurityContext securityContext, ShowDetails showDetails) {
if (showDetails == ShowDetails.NEVER || (showDetails == ShowDetails.WHEN_AUTHORIZED
&& (securityContext.getPrincipal() == null || !isUserInRole(securityContext)))) {
return false;
}
return true;
return showDetails != ShowDetails.NEVER && (showDetails != ShowDetails.WHEN_AUTHORIZED
|| (securityContext.getPrincipal() != null && isUserInRole(securityContext)));
}
private boolean isUserInRole(SecurityContext securityContext) {

Loading…
Cancel
Save