diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryEndpointFilter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryEndpointFilter.java index 993954ba80..812515f57f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryEndpointFilter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryEndpointFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryReactiveHealthEndpointWebExtension.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryReactiveHealthEndpointWebExtension.java index 6c4458e301..4aaa4e55d7 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryReactiveHealthEndpointWebExtension.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryReactiveHealthEndpointWebExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryHealthEndpointWebExtension.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryHealthEndpointWebExtension.java index c908742b6e..87e211ae37 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryHealthEndpointWebExtension.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryHealthEndpointWebExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementContextAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementContextAutoConfiguration.java index 25b48da8cf..ff34749f72 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementContextAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementContextAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcEndpointIntegrationTests.java index 3061ac77c6..1d4fb3f049 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcEndpointIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/AbstractWebEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/AbstractWebEndpointIntegrationTests.java index 3a62ab74b2..2563b1906c 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/AbstractWebEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/AbstractWebEndpointIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/StaticResourceLocation.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/StaticResourceLocation.java index 7e4bbad3b0..a2bd404d28 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/StaticResourceLocation.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/StaticResourceLocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientAutoConfiguration.java index d4c1e446b9..5f2c1d513a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/reactive/StaticResourceRequest.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/reactive/StaticResourceRequest.java index 86c06f940b..1ab9975e30 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/reactive/StaticResourceRequest.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/reactive/StaticResourceRequest.java @@ -33,8 +33,8 @@ import org.springframework.util.Assert; import org.springframework.web.server.ServerWebExchange; /** - * Factory that can be used to create a {@link ServerWebExchangeMatcher} for static resources in - * commonly used locations. + * Factory that can be used to create a {@link ServerWebExchangeMatcher} for static + * resources in commonly used locations. * * @author Madhura Bhave * @since 2.0.0 @@ -45,10 +45,11 @@ public final class StaticResourceRequest { } /** - * Returns a matcher that includes all commonly used {@link StaticResourceLocation Locations}. The - * {@link StaticResourceServerWebExchange#excluding(StaticResourceLocation, StaticResourceLocation...) excluding} - * method can be used to remove specific locations if required. For example: - *
+ * Returns a matcher that includes all commonly used {@link StaticResourceLocation + * Locations}. The + * {@link StaticResourceServerWebExchange#excluding(StaticResourceLocation, StaticResourceLocation...) + * excluding} method can be used to remove specific locations if required. For + * example:* StaticResourceRequest.toCommonLocations().excluding(StaticResourceLocation.CSS) ** @return the configured {@link ServerWebExchangeMatcher} @@ -58,33 +59,36 @@ public final class StaticResourceRequest { } /** - * Returns a matcher that includes the specified {@link StaticResourceLocation Locations}. For - * example:+ * Returns a matcher that includes the specified {@link StaticResourceLocation + * Locations}. For example:* to(StaticResourceLocation.CSS, StaticResourceLocation.JAVA_SCRIPT) ** @param first the first location to include * @param rest additional locations to include * @return the configured {@link ServerWebExchangeMatcher} */ - public static StaticResourceServerWebExchange to(StaticResourceLocation first, StaticResourceLocation... rest) { + public static StaticResourceServerWebExchange to(StaticResourceLocation first, + StaticResourceLocation... rest) { return to(EnumSet.of(first, rest)); } /** - * Returns a matcher that includes the specified {@link StaticResourceLocation Locations}. For - * example:+ * Returns a matcher that includes the specified {@link StaticResourceLocation + * Locations}. For example:* to(locations) ** @param locations the locations to include * @return the configured {@link ServerWebExchangeMatcher} */ - public static StaticResourceServerWebExchange to(Setlocations) { + public static StaticResourceServerWebExchange to( + Set locations) { Assert.notNull(locations, "Locations must not be null"); return new StaticResourceServerWebExchange(new LinkedHashSet<>(locations)); } /** - * The server web exchange matcher used to match against resource {@link StaticResourceLocation Locations}. + * The server web exchange matcher used to match against resource + * {@link StaticResourceLocation Locations}. */ public final static class StaticResourceServerWebExchange implements ServerWebExchangeMatcher { @@ -102,7 +106,8 @@ public final class StaticResourceRequest { * @param rest additional locations to exclude * @return a new {@link StaticResourceServerWebExchange} */ - public StaticResourceServerWebExchange excluding(StaticResourceLocation first, StaticResourceLocation... rest) { + public StaticResourceServerWebExchange excluding(StaticResourceLocation first, + StaticResourceLocation... rest) { return excluding(EnumSet.of(first, rest)); } @@ -112,7 +117,8 @@ public final class StaticResourceRequest { * @param locations the locations to exclude * @return a new {@link StaticResourceServerWebExchange} */ - public StaticResourceServerWebExchange excluding(Set locations) { + public StaticResourceServerWebExchange excluding( + Set locations) { Assert.notNull(locations, "Locations must not be null"); Set subset = new LinkedHashSet<>(this.locations); subset.removeAll(locations); @@ -130,10 +136,10 @@ public final class StaticResourceRequest { @Override public Mono matches(ServerWebExchange exchange) { - OrServerWebExchangeMatcher matcher = new OrServerWebExchangeMatcher(getDelegateMatchers()); + OrServerWebExchangeMatcher matcher = new OrServerWebExchangeMatcher( + getDelegateMatchers()); return matcher.matches(exchange); } } } - diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/AuthenticationManagerConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/AuthenticationManagerConfiguration.java index 3fd612dc2e..f77ed25007 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/AuthenticationManagerConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/AuthenticationManagerConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfiguration.java index 6da25a28b6..b984053ae2 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SecurityFilterAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SecurityFilterAutoConfiguration.java index eca984e21a..b9864ccf38 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SecurityFilterAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SecurityFilterAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SpringBootWebSecurityConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SpringBootWebSecurityConfiguration.java index 63c706b233..d2bef77ed3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SpringBootWebSecurityConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SpringBootWebSecurityConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/StaticResourceRequest.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/StaticResourceRequest.java index b946968af9..d4ab0f2f0e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/StaticResourceRequest.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/StaticResourceRequest.java @@ -47,10 +47,11 @@ public final class StaticResourceRequest { } /** - * Returns a matcher that includes all commonly used {@link StaticResourceLocation Locations}. The - * {@link StaticResourceRequestMatcher#excluding(StaticResourceLocation, StaticResourceLocation...) excluding} - * method can be used to remove specific locations if required. For example: - * + * Returns a matcher that includes all commonly used {@link StaticResourceLocation + * Locations}. The + * {@link StaticResourceRequestMatcher#excluding(StaticResourceLocation, StaticResourceLocation...) + * excluding} method can be used to remove specific locations if required. For + * example:* StaticResourceRequest.toCommonLocations().excluding(StaticResourceLocation.CSS) ** @return the configured {@link RequestMatcher} @@ -60,21 +61,22 @@ public final class StaticResourceRequest { } /** - * Returns a matcher that includes the specified {@link StaticResourceLocation Locations}. For - * example:+ * Returns a matcher that includes the specified {@link StaticResourceLocation + * Locations}. For example:* StaticResourceRequest.to(StaticResourceLocation.CSS, StaticResourceLocation.JAVA_SCRIPT) ** @param first the first location to include * @param rest additional locations to include * @return the configured {@link RequestMatcher} */ - public static StaticResourceRequestMatcher to(StaticResourceLocation first, StaticResourceLocation... rest) { + public static StaticResourceRequestMatcher to(StaticResourceLocation first, + StaticResourceLocation... rest) { return to(EnumSet.of(first, rest)); } /** - * Returns a matcher that includes the specified {@link StaticResourceLocation Locations}. For - * example:+ * Returns a matcher that includes the specified {@link StaticResourceLocation + * Locations}. For example:* StaticResourceRequest.to(locations) ** @param locations the locations to include @@ -86,7 +88,8 @@ public final class StaticResourceRequest { } /** - * The request matcher used to match against resource {@link StaticResourceLocation Locations}. + * The request matcher used to match against resource {@link StaticResourceLocation + * Locations}. */ public static final class StaticResourceRequestMatcher extends ApplicationContextRequestMatcher{ @@ -107,7 +110,8 @@ public final class StaticResourceRequest { * @param rest additional locations to exclude * @return a new {@link StaticResourceRequestMatcher} */ - public StaticResourceRequestMatcher excluding(StaticResourceLocation first, StaticResourceLocation... rest) { + public StaticResourceRequestMatcher excluding(StaticResourceLocation first, + StaticResourceLocation... rest) { return excluding(EnumSet.of(first, rest)); } @@ -117,7 +121,8 @@ public final class StaticResourceRequest { * @param locations the locations to exclude * @return a new {@link StaticResourceRequestMatcher} */ - public StaticResourceRequestMatcher excluding(Set locations) { + public StaticResourceRequestMatcher excluding( + Set locations) { Assert.notNull(locations, "Locations must not be null"); Set subset = new LinkedHashSet<>(this.locations); subset.removeAll(locations); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/WebSecurityEnablerConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/WebSecurityEnablerConfiguration.java index 4b768c56ee..5692e8c670 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/WebSecurityEnablerConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/WebSecurityEnablerConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java index 063c67b778..c4e2a31b52 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java @@ -187,24 +187,25 @@ public abstract class AbstractErrorWebExceptionHandler protected Mono renderDefaultErrorView( ServerResponse.BodyBuilder responseBody, Map error) { StringBuilder builder = new StringBuilder(); + Object message = error.get("message"); Date timestamp = (Date) error.get("timestamp"); builder.append(" Whitelabel Error Page
") .append("This application has no configured error view, so you are seeing this as a fallback.
") .append("").append(timestamp.toString()) .append("").append("There was an unexpected error (type=") - .append(HtmlUtils.htmlEscape(error.get("error").toString())) - .append(", status=") - .append(HtmlUtils.htmlEscape(error.get("status").toString())) - .append(")."); - if (error.get("message") != null) { - builder.append("") - .append(HtmlUtils.htmlEscape(error.get("message").toString())) - .append(""); + .append(htmlEscape(error.get("error"))).append(", status=") + .append(htmlEscape(error.get("status"))).append(")."); + if (message != null) { + builder.append("").append(htmlEscape(message)).append(""); } builder.append(""); return responseBody.syncBody(builder.toString()); } + private String htmlEscape(Object input) { + return (input == null ? null : HtmlUtils.htmlEscape(input.toString())); + } + @Override public void afterPropertiesSet() throws Exception { if (CollectionUtils.isEmpty(this.messageWriters)) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java index e31e4ff174..c8980bcf44 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/reactive/StaticResourceRequestTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/reactive/StaticResourceRequestTests.java index 4ac0300ea4..68a10f7fd7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/reactive/StaticResourceRequestTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/reactive/StaticResourceRequestTests.java @@ -68,7 +68,8 @@ public class StaticResourceRequestTests { @Test public void toLocationShouldMatchLocation() { - ServerWebExchangeMatcher matcher = StaticResourceRequest.to(StaticResourceLocation.CSS); + ServerWebExchangeMatcher matcher = StaticResourceRequest + .to(StaticResourceLocation.CSS); assertMatcher(matcher).matches("/css/file.css"); assertMatcher(matcher).doesNotMatch("/js/file.js"); } @@ -87,10 +88,12 @@ public class StaticResourceRequestTests { StaticResourceRequest.toCommonLocations().excluding(null); } - private StaticResourceRequestTests.RequestMatcherAssert assertMatcher(ServerWebExchangeMatcher matcher) { + private StaticResourceRequestTests.RequestMatcherAssert assertMatcher( + ServerWebExchangeMatcher matcher) { StaticWebApplicationContext context = new StaticWebApplicationContext(); context.registerBean(ServerProperties.class); - return assertThat(new StaticResourceRequestTests.RequestMatcherAssert(context, matcher)); + return assertThat( + new StaticResourceRequestTests.RequestMatcherAssert(context, matcher)); } private static class RequestMatcherAssert implements AssertDelegateTarget { @@ -99,13 +102,16 @@ public class StaticResourceRequestTests { private final ServerWebExchangeMatcher matcher; - RequestMatcherAssert(StaticApplicationContext context, ServerWebExchangeMatcher matcher) { + RequestMatcherAssert(StaticApplicationContext context, + ServerWebExchangeMatcher matcher) { this.context = context; this.matcher = matcher; } void matches(String path) { - ServerWebExchange exchange = webHandler().createExchange(MockServerHttpRequest.get(path).build(), new MockServerHttpResponse()); + ServerWebExchange exchange = webHandler().createExchange( + MockServerHttpRequest.get(path).build(), + new MockServerHttpResponse()); matches(exchange); } @@ -115,7 +121,9 @@ public class StaticResourceRequestTests { } void doesNotMatch(String path) { - ServerWebExchange exchange = webHandler().createExchange(MockServerHttpRequest.get(path).build(), new MockServerHttpResponse()); + ServerWebExchange exchange = webHandler().createExchange( + MockServerHttpRequest.get(path).build(), + new MockServerHttpResponse()); doesNotMatch(exchange); } @@ -125,7 +133,8 @@ public class StaticResourceRequestTests { } private TestHttpWebHandlerAdapter webHandler() { - TestHttpWebHandlerAdapter adapter = new TestHttpWebHandlerAdapter(mock(WebHandler.class)); + TestHttpWebHandlerAdapter adapter = new TestHttpWebHandlerAdapter( + mock(WebHandler.class)); adapter.setApplicationContext(this.context); return adapter; } @@ -143,7 +152,8 @@ public class StaticResourceRequestTests { } @Override - protected ServerWebExchange createExchange(ServerHttpRequest request, ServerHttpResponse response) { + protected ServerWebExchange createExchange(ServerHttpRequest request, + ServerHttpResponse response) { return super.createExchange(request, response); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java index 8c06d8d92a..5828cd2c6d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityFilterAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityFilterAutoConfigurationTests.java index 1bdae58fc1..cc9f3edae5 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityFilterAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityFilterAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/StaticResourceRequestTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/StaticResourceRequestTests.java index a10eff01e4..c41c13ed9c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/StaticResourceRequestTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/StaticResourceRequestTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,7 +92,8 @@ public class StaticResourceRequestTests { public void excludeFromSetWhenSetIsNullShouldThrowException() { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Locations must not be null"); - StaticResourceRequest.toCommonLocations().excluding((Set) null); + StaticResourceRequest.toCommonLocations() + .excluding((Set ) null); } private RequestMatcherAssert assertMatcher(RequestMatcher matcher) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java index e963875d3d..b24c4fe17f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java @@ -247,8 +247,8 @@ public class DefaultErrorWebExceptionHandlerIntegrationTests { .run((context) -> { WebTestClient client = WebTestClient.bindToApplicationContext(context) .build(); - String body = client.get().uri("/notfound").accept(MediaType.TEXT_HTML) - .exchange().expectStatus() + String body = client.get().uri("/notfound") + .accept(MediaType.TEXT_HTML).exchange().expectStatus() .isEqualTo(HttpStatus.NOT_FOUND).expectHeader() .contentType(MediaType.TEXT_HTML).expectBody(String.class) .returnResult().getResponseBody(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/FilterOrderingIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/FilterOrderingIntegrationTests.java index 0f2e5d5268..a1c5b56251 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/FilterOrderingIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/FilterOrderingIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcSecurityAutoConfiguration.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcSecurityAutoConfiguration.java index 3ab025061a..93b35b067b 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcSecurityAutoConfiguration.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcSecurityAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsTestApplication.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsTestApplication.java index a6d894632f..04497248ad 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsTestApplication.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsTestApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-samples/spring-boot-sample-secure-webflux/src/test/java/sample/secure/webflux/SampleSecureWebFluxCustomSecurityTests.java b/spring-boot-samples/spring-boot-sample-secure-webflux/src/test/java/sample/secure/webflux/SampleSecureWebFluxCustomSecurityTests.java index c0aba6970c..985e53aa49 100644 --- a/spring-boot-samples/spring-boot-sample-secure-webflux/src/test/java/sample/secure/webflux/SampleSecureWebFluxCustomSecurityTests.java +++ b/spring-boot-samples/spring-boot-sample-secure-webflux/src/test/java/sample/secure/webflux/SampleSecureWebFluxCustomSecurityTests.java @@ -80,8 +80,8 @@ public class SampleSecureWebFluxCustomSecurityTests { @Test public void staticResourceShouldBeAccessible() { - this.webClient.get().uri("/css/bootstrap.min.css").accept(MediaType.APPLICATION_JSON).exchange() - .expectStatus().isOk(); + this.webClient.get().uri("/css/bootstrap.min.css") + .accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk(); } @Configuration @@ -100,9 +100,10 @@ public class SampleSecureWebFluxCustomSecurityTests { SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { http.authorizeExchange().matchers(EndpointRequest.to("health", "info")) .permitAll().matchers(EndpointRequest.toAnyEndpoint()) - .hasRole("ACTUATOR").matchers(StaticResourceRequest.toCommonLocations()).permitAll() - .pathMatchers("/login").permitAll().anyExchange() - .authenticated().and().httpBasic(); + .hasRole("ACTUATOR") + .matchers(StaticResourceRequest.toCommonLocations()).permitAll() + .pathMatchers("/login").permitAll().anyExchange().authenticated() + .and().httpBasic(); return http.build(); } diff --git a/spring-boot-samples/spring-boot-sample-web-secure/src/main/java/sample/web/secure/SampleWebSecureApplication.java b/spring-boot-samples/spring-boot-sample-web-secure/src/main/java/sample/web/secure/SampleWebSecureApplication.java index 3428844d37..8b8a8d5448 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure/src/main/java/sample/web/secure/SampleWebSecureApplication.java +++ b/spring-boot-samples/spring-boot-sample-web-secure/src/main/java/sample/web/secure/SampleWebSecureApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.