Format with Eclipse Oxygen SR2

pull/11981/merge
Phillip Webb 7 years ago
parent 1f8bc391ce
commit 798522d890

@ -377,7 +377,7 @@ public class CrshAutoConfiguration {
BeanFactoryFilteringPluginDiscovery(ClassLoader classLoader, BeanFactoryFilteringPluginDiscovery(ClassLoader classLoader,
ListableBeanFactory beanFactory, String[] disabledPlugins) ListableBeanFactory beanFactory, String[] disabledPlugins)
throws NullPointerException { throws NullPointerException {
super(classLoader); super(classLoader);
this.beanFactory = beanFactory; this.beanFactory = beanFactory;
this.disabledPlugins = disabledPlugins; this.disabledPlugins = disabledPlugins;

@ -98,7 +98,7 @@ final class MetricsFilter extends OncePerRequestFilter {
@Override @Override
protected void doFilterInternal(HttpServletRequest request, protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response, FilterChain chain) HttpServletResponse response, FilterChain chain)
throws ServletException, IOException { throws ServletException, IOException {
StopWatch stopWatch = createStopWatchIfNecessary(request); StopWatch stopWatch = createStopWatchIfNecessary(request);
String path = new UrlPathHelper().getPathWithinApplication(request); String path = new UrlPathHelper().getPathWithinApplication(request);
int status = HttpStatus.INTERNAL_SERVER_ERROR.value(); int status = HttpStatus.INTERNAL_SERVER_ERROR.value();

@ -89,10 +89,9 @@ public class PublicMetricsAutoConfiguration {
@Bean @Bean
public MetricReaderPublicMetrics metricReaderPublicMetrics() { public MetricReaderPublicMetrics metricReaderPublicMetrics() {
return new MetricReaderPublicMetrics( return new MetricReaderPublicMetrics(new CompositeMetricReader(
new CompositeMetricReader(this.metricReaders == null ? new MetricReader[0] this.metricReaders == null ? new MetricReader[0] : this.metricReaders
: this.metricReaders .toArray(new MetricReader[this.metricReaders.size()])));
.toArray(new MetricReader[this.metricReaders.size()])));
} }
@Bean @Bean

@ -89,9 +89,8 @@ public class CloudFoundryActuatorAutoConfiguration {
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api"); String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
boolean skipSslValidation = cloudFoundryProperties boolean skipSslValidation = cloudFoundryProperties
.getProperty("skip-ssl-validation", Boolean.class, false); .getProperty("skip-ssl-validation", Boolean.class, false);
return cloudControllerUrl == null ? null return cloudControllerUrl == null ? null : new CloudFoundrySecurityService(
: new CloudFoundrySecurityService(restTemplateBuilder, cloudControllerUrl, restTemplateBuilder, cloudControllerUrl, skipSslValidation);
skipSslValidation);
} }
private CorsConfiguration getCorsConfiguration() { private CorsConfiguration getCorsConfiguration() {

@ -76,7 +76,7 @@ public class HeapdumpMvcEndpoint extends AbstractNamedMvcEndpoint {
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public void invoke(@RequestParam(defaultValue = "true") boolean live, public void invoke(@RequestParam(defaultValue = "true") boolean live,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException { throws IOException, ServletException {
if (!isEnabled()) { if (!isEnabled()) {
response.setStatus(HttpStatus.NOT_FOUND.value()); response.setStatus(HttpStatus.NOT_FOUND.value());
return; return;
@ -100,7 +100,7 @@ public class HeapdumpMvcEndpoint extends AbstractNamedMvcEndpoint {
private void dumpHeap(boolean live, HttpServletRequest request, private void dumpHeap(boolean live, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)
throws IOException, ServletException, InterruptedException { throws IOException, ServletException, InterruptedException {
if (this.heapDumper == null) { if (this.heapDumper == null) {
this.heapDumper = createHeapDumper(); this.heapDumper = createHeapDumper();
} }

@ -101,7 +101,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order
@Override @Override
protected void doFilterInternal(HttpServletRequest request, protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response, FilterChain filterChain) HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException { throws ServletException, IOException {
long startTime = System.nanoTime(); long startTime = System.nanoTime();
Map<String, Object> trace = getTrace(request); Map<String, Object> trace = getTrace(request);
logTrace(request, trace); logTrace(request, trace);

@ -548,7 +548,7 @@ public class MetricFilterAutoConfigurationTests {
@Override @Override
protected void doFilterInternal(HttpServletRequest request, protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response, FilterChain chain) HttpServletResponse response, FilterChain chain)
throws ServletException, IOException { throws ServletException, IOException {
// send redirect before filter chain is executed, like Spring Security sending // send redirect before filter chain is executed, like Spring Security sending
// us back to a login page // us back to a login page
response.sendRedirect("http://example.com"); response.sendRedirect("http://example.com");
@ -563,7 +563,7 @@ public class MetricFilterAutoConfigurationTests {
@Override @Override
protected void doFilterInternal(HttpServletRequest request, protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response, FilterChain chain) HttpServletResponse response, FilterChain chain)
throws ServletException, IOException { throws ServletException, IOException {
response.sendError(HttpStatus.SERVICE_UNAVAILABLE.value()); response.sendError(HttpStatus.SERVICE_UNAVAILABLE.value());
} }

@ -306,7 +306,7 @@ public class EndpointMBeanExporterTests {
private ObjectName getObjectName(String domain, String beanKey, private ObjectName getObjectName(String domain, String beanKey,
boolean includeIdentity, ApplicationContext applicationContext) boolean includeIdentity, ApplicationContext applicationContext)
throws MalformedObjectNameException { throws MalformedObjectNameException {
if (includeIdentity) { if (includeIdentity) {
return ObjectNameManager.getInstance(String.format( return ObjectNameManager.getInstance(String.format(
"%s:type=Endpoint,name=%s,identity=%s", domain, beanKey, ObjectUtils "%s:type=Endpoint,name=%s,identity=%s", domain, beanKey, ObjectUtils

@ -104,8 +104,8 @@ public class AuditEventsMvcEndpointTests {
@Test @Test
public void invokeFilterByPrincipalAndDateAfter() throws Exception { public void invokeFilterByPrincipalAndDateAfter() throws Exception {
this.mvc.perform(get("/auditevents").param("principal", "user").param("after", this.mvc.perform(get("/auditevents")
"2016-11-01T10:00:00+0000")) .param("principal", "user").param("after", "2016-11-01T10:00:00+0000"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(content().string( .andExpect(content().string(
containsString("\"principal\":\"user\",\"type\":\"login\""))) containsString("\"principal\":\"user\",\"type\":\"login\"")))

@ -124,7 +124,7 @@ public class BatchAutoConfiguration {
@ConditionalOnMissingBean(JobOperator.class) @ConditionalOnMissingBean(JobOperator.class)
public SimpleJobOperator jobOperator(JobExplorer jobExplorer, JobLauncher jobLauncher, public SimpleJobOperator jobOperator(JobExplorer jobExplorer, JobLauncher jobLauncher,
ListableJobLocator jobRegistry, JobRepository jobRepository) ListableJobLocator jobRegistry, JobRepository jobRepository)
throws Exception { throws Exception {
SimpleJobOperator factory = new SimpleJobOperator(); SimpleJobOperator factory = new SimpleJobOperator();
factory.setJobExplorer(jobExplorer); factory.setJobExplorer(jobExplorer);
factory.setJobLauncher(jobLauncher); factory.setJobLauncher(jobLauncher);

@ -69,7 +69,8 @@ public enum CacheType {
/** /**
* Guava backed caching. * Guava backed caching.
*/ */
@Deprecated GUAVA, @Deprecated
GUAVA,
/** /**
* Simple in-memory caching. * Simple in-memory caching.

@ -60,9 +60,8 @@ public class CouchbaseCacheConfiguration {
public CouchbaseCacheManager cacheManager() { public CouchbaseCacheManager cacheManager() {
List<String> cacheNames = this.cacheProperties.getCacheNames(); List<String> cacheNames = this.cacheProperties.getCacheNames();
CouchbaseCacheManager cacheManager = new CouchbaseCacheManager( CouchbaseCacheManager cacheManager = new CouchbaseCacheManager(
CacheBuilder.newInstance(this.bucket) CacheBuilder.newInstance(this.bucket).withExpiration(
.withExpiration(this.cacheProperties.getCouchbase() this.cacheProperties.getCouchbase().getExpirationSeconds()),
.getExpirationSeconds()),
cacheNames.toArray(new String[cacheNames.size()])); cacheNames.toArray(new String[cacheNames.size()]));
return this.customizers.customize(cacheManager); return this.customizers.customize(cacheManager);
} }

@ -231,7 +231,7 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
private Class<?> doGetFactoryBeanGeneric(ConfigurableListableBeanFactory beanFactory, private Class<?> doGetFactoryBeanGeneric(ConfigurableListableBeanFactory beanFactory,
BeanDefinition definition, String name) BeanDefinition definition, String name)
throws Exception, ClassNotFoundException, LinkageError { throws Exception, ClassNotFoundException, LinkageError {
if (StringUtils.hasLength(definition.getFactoryBeanName()) if (StringUtils.hasLength(definition.getFactoryBeanName())
&& StringUtils.hasLength(definition.getFactoryMethodName())) { && StringUtils.hasLength(definition.getFactoryMethodName())) {
return getConfigurationClassFactoryBeanGeneric(beanFactory, definition, name); return getConfigurationClassFactoryBeanGeneric(beanFactory, definition, name);

@ -165,7 +165,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
private Collection<String> getBeanNamesForType(ListableBeanFactory beanFactory, private Collection<String> getBeanNamesForType(ListableBeanFactory beanFactory,
String type, ClassLoader classLoader, boolean considerHierarchy) String type, ClassLoader classLoader, boolean considerHierarchy)
throws LinkageError { throws LinkageError {
try { try {
Set<String> result = new LinkedHashSet<String>(); Set<String> result = new LinkedHashSet<String>();
collectBeanNamesForType(result, beanFactory, collectBeanNamesForType(result, beanFactory,

@ -108,7 +108,7 @@ class OnPropertyCondition extends SpringBootCondition {
ConditionMessage.forCondition(ConditionalOnProperty.class, spec) ConditionMessage.forCondition(ConditionalOnProperty.class, spec)
.found("different value in property", .found("different value in property",
"different value in properties") "different value in properties")
.items(Style.QUOTE, nonMatchingProperties)); .items(Style.QUOTE, nonMatchingProperties));
} }
return ConditionOutcome.match(ConditionMessage return ConditionOutcome.match(ConditionMessage
.forCondition(ConditionalOnProperty.class, spec).because("matched")); .forCondition(ConditionalOnProperty.class, spec).because("matched"));

@ -32,7 +32,8 @@ public enum SearchStrategy {
* Search all parents and ancestors, but not the current context. * Search all parents and ancestors, but not the current context.
* @deprecated as of 1.5 in favor of {@link SearchStrategy#ANCESTORS} * @deprecated as of 1.5 in favor of {@link SearchStrategy#ANCESTORS}
*/ */
@Deprecated PARENTS, @Deprecated
PARENTS,
/** /**
* Search all ancestors, but not the current context. * Search all ancestors, but not the current context.

@ -229,7 +229,7 @@ public class RedisAutoConfiguration {
@ConditionalOnMissingBean(name = "redisTemplate") @ConditionalOnMissingBean(name = "redisTemplate")
public RedisTemplate<Object, Object> redisTemplate( public RedisTemplate<Object, Object> redisTemplate(
RedisConnectionFactory redisConnectionFactory) RedisConnectionFactory redisConnectionFactory)
throws UnknownHostException { throws UnknownHostException {
RedisTemplate<Object, Object> template = new RedisTemplate<Object, Object>(); RedisTemplate<Object, Object> template = new RedisTemplate<Object, Object>();
template.setConnectionFactory(redisConnectionFactory); template.setConnectionFactory(redisConnectionFactory);
return template; return template;
@ -239,7 +239,7 @@ public class RedisAutoConfiguration {
@ConditionalOnMissingBean(StringRedisTemplate.class) @ConditionalOnMissingBean(StringRedisTemplate.class)
public StringRedisTemplate stringRedisTemplate( public StringRedisTemplate stringRedisTemplate(
RedisConnectionFactory redisConnectionFactory) RedisConnectionFactory redisConnectionFactory)
throws UnknownHostException { throws UnknownHostException {
StringRedisTemplate template = new StringRedisTemplate(); StringRedisTemplate template = new StringRedisTemplate();
template.setConnectionFactory(redisConnectionFactory); template.setConnectionFactory(redisConnectionFactory);
return template; return template;

@ -109,9 +109,8 @@ public class FlywayAutoConfiguration {
Assert.state(!this.properties.getLocations().isEmpty(), Assert.state(!this.properties.getLocations().isEmpty(),
"Migration script locations not configured"); "Migration script locations not configured");
boolean exists = hasAtLeastOneLocation(); boolean exists = hasAtLeastOneLocation();
Assert.state(exists, Assert.state(exists, "Cannot find migrations location in: "
"Cannot find migrations location in: " + this.properties + this.properties.getLocations()
.getLocations()
+ " (please add migrations or check your Flyway configuration)"); + " (please add migrations or check your Flyway configuration)");
} }
} }

@ -82,7 +82,7 @@ class ActiveMQConnectionFactoryFactory {
private <T extends ActiveMQConnectionFactory> T createConnectionFactoryInstance( private <T extends ActiveMQConnectionFactory> T createConnectionFactoryInstance(
Class<T> factoryClass) throws InstantiationException, IllegalAccessException, Class<T> factoryClass) throws InstantiationException, IllegalAccessException,
InvocationTargetException, NoSuchMethodException { InvocationTargetException, NoSuchMethodException {
String brokerUrl = determineBrokerUrl(); String brokerUrl = determineBrokerUrl();
String user = this.properties.getUser(); String user = this.properties.getUser();
String password = this.properties.getPassword(); String password = this.properties.getPassword();

@ -47,7 +47,7 @@ class ArtemisXAConnectionFactoryConfiguration {
@Bean(name = { "jmsConnectionFactory", "xaJmsConnectionFactory" }) @Bean(name = { "jmsConnectionFactory", "xaJmsConnectionFactory" })
public ConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory, public ConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory,
ArtemisProperties properties, XAConnectionFactoryWrapper wrapper) ArtemisProperties properties, XAConnectionFactoryWrapper wrapper)
throws Exception { throws Exception {
return wrapper.wrapConnectionFactory( return wrapper.wrapConnectionFactory(
new ArtemisConnectionFactoryFactory(beanFactory, properties) new ArtemisConnectionFactoryFactory(beanFactory, properties)
.createConnectionFactory(ActiveMQXAConnectionFactory.class)); .createConnectionFactory(ActiveMQXAConnectionFactory.class));

@ -41,8 +41,8 @@ class EnableOAuth2SsoCondition extends SpringBootCondition {
for (String name : enablers) { for (String name : enablers) {
if (context.getBeanFactory().isTypeMatch(name, if (context.getBeanFactory().isTypeMatch(name,
WebSecurityConfigurerAdapter.class)) { WebSecurityConfigurerAdapter.class)) {
return ConditionOutcome.match(message return ConditionOutcome.match(message.found(
.found("@EnableOAuth2Sso annotation on WebSecurityConfigurerAdapter") "@EnableOAuth2Sso annotation on WebSecurityConfigurerAdapter")
.items(name)); .items(name));
} }
} }

@ -288,10 +288,9 @@ public class WebMvcAutoConfiguration {
} }
Integer cachePeriod = this.resourceProperties.getCachePeriod(); Integer cachePeriod = this.resourceProperties.getCachePeriod();
if (!registry.hasMappingForPattern("/webjars/**")) { if (!registry.hasMappingForPattern("/webjars/**")) {
customizeResourceHandlerRegistration( customizeResourceHandlerRegistration(registry
registry.addResourceHandler("/webjars/**") .addResourceHandler("/webjars/**")
.addResourceLocations( .addResourceLocations("classpath:/META-INF/resources/webjars/")
"classpath:/META-INF/resources/webjars/")
.setCachePeriod(cachePeriod)); .setCachePeriod(cachePeriod));
} }
String staticPathPattern = this.mvcProperties.getStaticPathPattern(); String staticPathPattern = this.mvcProperties.getStaticPathPattern();
@ -300,7 +299,7 @@ public class WebMvcAutoConfiguration {
registry.addResourceHandler(staticPathPattern) registry.addResourceHandler(staticPathPattern)
.addResourceLocations( .addResourceLocations(
this.resourceProperties.getStaticLocations()) this.resourceProperties.getStaticLocations())
.setCachePeriod(cachePeriod)); .setCachePeriod(cachePeriod));
} }
} }

@ -194,15 +194,17 @@ public class NoSuchBeanDefinitionFailureAnalyzerTests {
} }
private void assertActionMissingType(FailureAnalysis analysis, Class<?> type) { private void assertActionMissingType(FailureAnalysis analysis, Class<?> type) {
assertThat(analysis.getAction()).startsWith(String assertThat(analysis.getAction()).startsWith(String.format(
.format("Consider revisiting the conditions above or defining a bean of type '%s' " "Consider revisiting the conditions above or defining a bean of type '%s' "
+ "in your configuration.", type.getName())); + "in your configuration.",
type.getName()));
} }
private void assertActionMissingName(FailureAnalysis analysis, String name) { private void assertActionMissingName(FailureAnalysis analysis, String name) {
assertThat(analysis.getAction()).startsWith(String assertThat(analysis.getAction()).startsWith(String.format(
.format("Consider revisiting the conditions above or defining a bean named '%s' " "Consider revisiting the conditions above or defining a bean named '%s' "
+ "in your configuration.", name)); + "in your configuration.",
name));
} }
private void assertBeanMethodDisabled(FailureAnalysis analysis, String description, private void assertBeanMethodDisabled(FailureAnalysis analysis, String description,

@ -492,7 +492,7 @@ public class JacksonAutoConfigurationTests {
@Override @Override
public void serialize(Foo value, JsonGenerator jgen, public void serialize(Foo value, JsonGenerator jgen,
SerializerProvider provider) SerializerProvider provider)
throws IOException, JsonProcessingException { throws IOException, JsonProcessingException {
jgen.writeStartObject(); jgen.writeStartObject();
jgen.writeStringField("foo", "bar"); jgen.writeStringField("foo", "bar");
jgen.writeEndObject(); jgen.writeEndObject();

@ -140,16 +140,15 @@ public class DataSourceInitializerTests {
@Test @Test
public void testDataSourceInitializedWithMultipleScripts() throws Exception { public void testDataSourceInitializedWithMultipleScripts() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context, EnvironmentTestUtils
"spring.datasource.initialize:true", .addEnvironment(this.context, "spring.datasource.initialize:true",
"spring.datasource.schema:" "spring.datasource.schema:" + ClassUtils
+ ClassUtils.addResourcePathToPackagePath(getClass(), .addResourcePathToPackagePath(getClass(), "schema.sql")
"schema.sql") + ","
+ "," + ClassUtils.addResourcePathToPackagePath(getClass(),
+ ClassUtils.addResourcePathToPackagePath(getClass(), "another.sql"),
"another.sql"), "spring.datasource.data:" + ClassUtils
"spring.datasource.data:" + ClassUtils .addResourcePathToPackagePath(getClass(), "data.sql"));
.addResourcePathToPackagePath(getClass(), "data.sql"));
this.context.register(DataSourceAutoConfiguration.class, this.context.register(DataSourceAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class);
this.context.refresh(); this.context.refresh();

@ -104,8 +104,10 @@ public class SecurityAutoConfigurationTests {
ServerPropertiesAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertThat(this.context.getBean("securityFilterChainRegistration", assertThat(this.context
DelegatingFilterProxyRegistrationBean.class).getOrder()).isEqualTo( .getBean("securityFilterChainRegistration",
DelegatingFilterProxyRegistrationBean.class)
.getOrder()).isEqualTo(
FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100); FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100);
} }
@ -134,8 +136,10 @@ public class SecurityAutoConfigurationTests {
ServerPropertiesAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertThat(this.context.getBean("securityFilterChainRegistration", assertThat(this.context
DelegatingFilterProxyRegistrationBean.class).getOrder()).isEqualTo( .getBean("securityFilterChainRegistration",
DelegatingFilterProxyRegistrationBean.class)
.getOrder()).isEqualTo(
FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100); FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100);
} }

@ -220,7 +220,7 @@ public class BasicErrorControllerIntegrationTests {
@Override @Override
protected void renderMergedOutputModel(Map<String, Object> model, protected void renderMergedOutputModel(Map<String, Object> model,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws Exception { throws Exception {
response.getWriter().write("ERROR_BEAN"); response.getWriter().write("ERROR_BEAN");
} }
}; };

@ -150,7 +150,7 @@ public class BasicErrorControllerMockMvcTests {
@Override @Override
protected void renderMergedOutputModel(Map<String, Object> model, protected void renderMergedOutputModel(Map<String, Object> model,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws Exception { throws Exception {
response.getWriter().write("ERROR_BEAN"); response.getWriter().write("ERROR_BEAN");
} }
}; };

@ -803,7 +803,7 @@ public class WebMvcAutoConfigurationTests {
@Override @Override
protected void renderMergedOutputModel(Map<String, Object> model, protected void renderMergedOutputModel(Map<String, Object> model,
HttpServletRequest request, HttpServletResponse response) HttpServletRequest request, HttpServletResponse response)
throws Exception { throws Exception {
response.getOutputStream().write("Hello World".getBytes()); response.getOutputStream().write("Hello World".getBytes());
} }
}; };

@ -185,7 +185,7 @@ abstract class ArchiveCommand extends OptionParsingCommand {
private void writeJar(File file, Class<?>[] compiledClasses, private void writeJar(File file, Class<?>[] compiledClasses,
List<MatchedResource> classpathEntries, List<URL> dependencies) List<MatchedResource> classpathEntries, List<URL> dependencies)
throws FileNotFoundException, IOException, URISyntaxException { throws FileNotFoundException, IOException, URISyntaxException {
final List<Library> libraries; final List<Library> libraries;
JarWriter writer = new JarWriter(file); JarWriter writer = new JarWriter(file);
try { try {

@ -89,7 +89,7 @@ public abstract class CompilerAutoConfiguration {
*/ */
public void apply(GroovyClassLoader loader, GroovyCompilerConfiguration configuration, public void apply(GroovyClassLoader loader, GroovyCompilerConfiguration configuration,
GeneratorContext generatorContext, SourceUnit source, ClassNode classNode) GeneratorContext generatorContext, SourceUnit source, ClassNode classNode)
throws CompilationFailedException { throws CompilationFailedException {
} }
} }

@ -38,9 +38,8 @@ public class SpringSecurityCompilerAutoConfiguration extends CompilerAutoConfigu
@Override @Override
public void applyDependencies(DependencyCustomizer dependencies) { public void applyDependencies(DependencyCustomizer dependencies) {
dependencies dependencies.ifAnyMissingClasses(
.ifAnyMissingClasses( "org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity")
"org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity")
.add("spring-boot-starter-security"); .add("spring-boot-starter-security");
} }

@ -53,7 +53,7 @@ public class SpringTestCompilerAutoConfiguration extends CompilerAutoConfigurati
@Override @Override
public void apply(GroovyClassLoader loader, GroovyCompilerConfiguration configuration, public void apply(GroovyClassLoader loader, GroovyCompilerConfiguration configuration,
GeneratorContext generatorContext, SourceUnit source, ClassNode classNode) GeneratorContext generatorContext, SourceUnit source, ClassNode classNode)
throws CompilationFailedException { throws CompilationFailedException {
if (!AstUtils.hasAtLeastOneAnnotation(classNode, "RunWith")) { if (!AstUtils.hasAtLeastOneAnnotation(classNode, "RunWith")) {
AnnotationNode runWith = new AnnotationNode(ClassHelper.make("RunWith")); AnnotationNode runWith = new AnnotationNode(ClassHelper.make("RunWith"));
runWith.addMember("value", runWith.addMember("value",

@ -38,9 +38,8 @@ public class SpringWebsocketCompilerAutoConfiguration extends CompilerAutoConfig
@Override @Override
public void applyDependencies(DependencyCustomizer dependencies) { public void applyDependencies(DependencyCustomizer dependencies) {
dependencies dependencies.ifAnyMissingClasses(
.ifAnyMissingClasses( "org.springframework.web.socket.config.annotation.EnableWebSocket")
"org.springframework.web.socket.config.annotation.EnableWebSocket")
.add("spring-boot-starter-websocket").add("spring-messaging"); .add("spring-boot-starter-websocket").add("spring-messaging");
} }

@ -94,9 +94,8 @@ public class AetherGrapeEngine implements GrapeEngine {
private ProgressReporter getProgressReporter(DefaultRepositorySystemSession session, private ProgressReporter getProgressReporter(DefaultRepositorySystemSession session,
boolean quiet) { boolean quiet) {
String progressReporter = (quiet ? "none" String progressReporter = (quiet ? "none" : System.getProperty(
: System.getProperty( "org.springframework.boot.cli.compiler.grape.ProgressReporter"));
"org.springframework.boot.cli.compiler.grape.ProgressReporter"));
if ("detail".equals(progressReporter) if ("detail".equals(progressReporter)
|| Boolean.getBoolean("groovy.grape.report.downloads")) { || Boolean.getBoolean("groovy.grape.report.downloads")) {
return new DetailedProgressReporter(session, System.out); return new DetailedProgressReporter(session, System.out);

@ -105,9 +105,8 @@ public class DependencyResolutionContext {
aetherDependency); aetherDependency);
} }
this.dependencyManagement = this.dependencyManagement == null this.dependencyManagement = this.dependencyManagement == null
? dependencyManagement ? dependencyManagement : new CompositeDependencyManagement(
: new CompositeDependencyManagement(dependencyManagement, dependencyManagement, this.dependencyManagement);
this.dependencyManagement);
this.artifactCoordinatesResolver = new DependencyManagementArtifactCoordinatesResolver( this.artifactCoordinatesResolver = new DependencyManagementArtifactCoordinatesResolver(
this.dependencyManagement); this.dependencyManagement);
} }

@ -47,8 +47,8 @@ public abstract class GroovyTemplate {
} }
public static String template(TemplateEngine engine, String name, public static String template(TemplateEngine engine, String name,
Map<String, ?> model) throws IOException, CompilationFailedException, Map<String, ?> model)
ClassNotFoundException { throws IOException, CompilationFailedException, ClassNotFoundException {
Writable writable = getTemplate(engine, name).make(model); Writable writable = getTemplate(engine, name).make(model);
StringWriter result = new StringWriter(); StringWriter result = new StringWriter();
writable.writeTo(result); writable.writeTo(result);

@ -49,12 +49,13 @@ public class TomcatLegacyCookieProcessorExample {
((TomcatEmbeddedServletContainerFactory) container) ((TomcatEmbeddedServletContainerFactory) container)
.addContextCustomizers(new TomcatContextCustomizer() { .addContextCustomizers(new TomcatContextCustomizer() {
@Override @Override
public void customize(Context context) { public void customize(Context context) {
context.setCookieProcessor(new LegacyCookieProcessor()); context.setCookieProcessor(
} new LegacyCookieProcessor());
}
}); });
} }
} }

@ -50,7 +50,7 @@ public class RestTemplateProxyCustomizationExample {
@Override @Override
public HttpHost determineProxy(HttpHost target, public HttpHost determineProxy(HttpHost target,
HttpRequest request, HttpContext context) HttpRequest request, HttpContext context)
throws HttpException { throws HttpException {
if (target.getHostName().equals("192.168.0.5")) { if (target.getHostName().equals("192.168.0.5")) {
return null; return null;
} }

@ -68,8 +68,8 @@ public class SampleDataRestApplicationTests {
@Test @Test
public void findByNameAndCountry() throws Exception { public void findByNameAndCountry() throws Exception {
this.mvc.perform( this.mvc.perform(get(
get("/api/cities/search/findByNameAndCountryAllIgnoringCase?name=Melbourne&country=Australia")) "/api/cities/search/findByNameAndCountryAllIgnoringCase?name=Melbourne&country=Australia"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("state", equalTo("Victoria"))) .andExpect(jsonPath("state", equalTo("Victoria")))
.andExpect(jsonPath("name", equalTo("Melbourne"))); .andExpect(jsonPath("name", equalTo("Melbourne")));
@ -78,8 +78,8 @@ public class SampleDataRestApplicationTests {
@Test @Test
public void findByContaining() throws Exception { public void findByContaining() throws Exception {
this.mvc.perform( this.mvc.perform(get(
get("/api/cities/search/findByNameContainingAndCountryContainingAllIgnoringCase?name=&country=UK")) "/api/cities/search/findByNameContainingAndCountryContainingAllIgnoringCase?name=&country=UK"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("_embedded.cities", hasSize(3))); .andExpect(jsonPath("_embedded.cities", hasSize(3)));
} }

@ -93,7 +93,7 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected final boolean isTypeOrAnnotated(MetadataReader metadataReader, protected final boolean isTypeOrAnnotated(MetadataReader metadataReader,
MetadataReaderFactory metadataReaderFactory, Class<?> type) MetadataReaderFactory metadataReaderFactory, Class<?> type)
throws IOException { throws IOException {
AnnotationTypeFilter annotationFilter = new AnnotationTypeFilter( AnnotationTypeFilter annotationFilter = new AnnotationTypeFilter(
(Class<? extends Annotation>) type); (Class<? extends Annotation>) type);
AssignableTypeFilter typeFilter = new AssignableTypeFilter(type); AssignableTypeFilter typeFilter = new AssignableTypeFilter(type);

@ -53,7 +53,7 @@ public class ExampleJsonComponent {
@Override @Override
protected ExampleCustomObject deserializeObject(JsonParser jsonParser, protected ExampleCustomObject deserializeObject(JsonParser jsonParser,
DeserializationContext context, ObjectCodec codec, JsonNode tree) DeserializationContext context, ObjectCodec codec, JsonNode tree)
throws IOException { throws IOException {
return new ExampleCustomObject( return new ExampleCustomObject(
nullSafeValue(tree.get("value"), String.class)); nullSafeValue(tree.get("value"), String.class));
} }

@ -370,7 +370,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
@Override @Override
public PropertyValues postProcessPropertyValues(PropertyValues pvs, public PropertyValues postProcessPropertyValues(PropertyValues pvs,
PropertyDescriptor[] pds, final Object bean, String beanName) PropertyDescriptor[] pds, final Object bean, String beanName)
throws BeansException { throws BeansException {
ReflectionUtils.doWithFields(bean.getClass(), new FieldCallback() { ReflectionUtils.doWithFields(bean.getClass(), new FieldCallback() {
@Override @Override

@ -492,7 +492,7 @@ public class TestRestTemplate {
*/ */
public <T> ResponseEntity<T> postForEntity(String url, Object request, public <T> ResponseEntity<T> postForEntity(String url, Object request,
Class<T> responseType, Map<String, ?> urlVariables) Class<T> responseType, Map<String, ?> urlVariables)
throws RestClientException { throws RestClientException {
return this.restTemplate.postForEntity(url, request, responseType, urlVariables); return this.restTemplate.postForEntity(url, request, responseType, urlVariables);
} }
@ -735,7 +735,7 @@ public class TestRestTemplate {
*/ */
public <T> ResponseEntity<T> exchange(String url, HttpMethod method, public <T> ResponseEntity<T> exchange(String url, HttpMethod method,
HttpEntity<?> requestEntity, Class<T> responseType, Object... urlVariables) HttpEntity<?> requestEntity, Class<T> responseType, Object... urlVariables)
throws RestClientException { throws RestClientException {
return this.restTemplate.exchange(url, method, requestEntity, responseType, return this.restTemplate.exchange(url, method, requestEntity, responseType,
urlVariables); urlVariables);
} }
@ -780,7 +780,7 @@ public class TestRestTemplate {
*/ */
public <T> ResponseEntity<T> exchange(URI url, HttpMethod method, public <T> ResponseEntity<T> exchange(URI url, HttpMethod method,
HttpEntity<?> requestEntity, Class<T> responseType) HttpEntity<?> requestEntity, Class<T> responseType)
throws RestClientException { throws RestClientException {
return this.restTemplate.exchange(applyRootUriIfNecessary(url), method, return this.restTemplate.exchange(applyRootUriIfNecessary(url), method,
requestEntity, responseType); requestEntity, responseType);
} }
@ -863,7 +863,7 @@ public class TestRestTemplate {
*/ */
public <T> ResponseEntity<T> exchange(URI url, HttpMethod method, public <T> ResponseEntity<T> exchange(URI url, HttpMethod method,
HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType) HttpEntity<?> requestEntity, ParameterizedTypeReference<T> responseType)
throws RestClientException { throws RestClientException {
return this.restTemplate.exchange(applyRootUriIfNecessary(url), method, return this.restTemplate.exchange(applyRootUriIfNecessary(url), method,
requestEntity, responseType); requestEntity, responseType);
} }
@ -931,7 +931,7 @@ public class TestRestTemplate {
*/ */
public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback, public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
ResponseExtractor<T> responseExtractor, Object... urlVariables) ResponseExtractor<T> responseExtractor, Object... urlVariables)
throws RestClientException { throws RestClientException {
return this.restTemplate.execute(url, method, requestCallback, responseExtractor, return this.restTemplate.execute(url, method, requestCallback, responseExtractor,
urlVariables); urlVariables);
} }
@ -955,7 +955,7 @@ public class TestRestTemplate {
*/ */
public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback, public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
ResponseExtractor<T> responseExtractor, Map<String, ?> urlVariables) ResponseExtractor<T> responseExtractor, Map<String, ?> urlVariables)
throws RestClientException { throws RestClientException {
return this.restTemplate.execute(url, method, requestCallback, responseExtractor, return this.restTemplate.execute(url, method, requestCallback, responseExtractor,
urlVariables); urlVariables);
} }

@ -255,7 +255,7 @@ public class TestRestTemplateTests {
testRestTemplate.exchange( testRestTemplate.exchange(
new RequestEntity<String>(HttpMethod.GET, relativeUri), new RequestEntity<String>(HttpMethod.GET, relativeUri),
new ParameterizedTypeReference<String>() { new ParameterizedTypeReference<String>() {
}); });
} }
}); });
@ -286,7 +286,7 @@ public class TestRestTemplateTests {
testRestTemplate.exchange(relativeUri, HttpMethod.GET, testRestTemplate.exchange(relativeUri, HttpMethod.GET,
new HttpEntity<byte[]>(new byte[0]), new HttpEntity<byte[]>(new byte[0]),
new ParameterizedTypeReference<String>() { new ParameterizedTypeReference<String>() {
}); });
} }
}); });

@ -52,8 +52,8 @@ import java.util.List;
* Each stringer may be used to encode a single top level value. Instances of this class * Each stringer may be used to encode a single top level value. Instances of this class
* are not thread safe. Although this class is nonfinal, it was not designed for * are not thread safe. Although this class is nonfinal, it was not designed for
* inheritance and should not be subclassed. In particular, self-use by overrideable * inheritance and should not be subclassed. In particular, self-use by overrideable
* methods is not specified. See <i>Effective Java</i> Item 17, * methods is not specified. See <i>Effective Java</i> Item 17, "Design and Document or
* "Design and Document or inheritance or else prohibit it" for further information. * inheritance or else prohibit it" for further information.
*/ */
public class JSONStringer { public class JSONStringer {

@ -54,8 +54,8 @@ package org.springframework.boot.configurationprocessor.json;
* Each tokener may be used to parse a single JSON string. Instances of this class are not * Each tokener may be used to parse a single JSON string. Instances of this class are not
* thread safe. Although this class is nonfinal, it was not designed for inheritance and * thread safe. Although this class is nonfinal, it was not designed for inheritance and
* should not be subclassed. In particular, self-use by overrideable methods is not * should not be subclassed. In particular, self-use by overrideable methods is not
* specified. See <i>Effective Java</i> Item 17, * specified. See <i>Effective Java</i> Item 17, "Design and Document or inheritance or
* "Design and Document or inheritance or else prohibit it" for further information. * else prohibit it" for further information.
*/ */
public class JSONTokener { public class JSONTokener {

@ -380,18 +380,14 @@ public class ConfigurationMetadataAnnotationProcessorTests {
ConfigurationMetadata metadata = compile(ClassWithNestedProperties.class); ConfigurationMetadata metadata = compile(ClassWithNestedProperties.class);
assertThat(metadata).has(Metadata.withGroup("nestedChildProps") assertThat(metadata).has(Metadata.withGroup("nestedChildProps")
.fromSource(ClassWithNestedProperties.NestedChildClass.class)); .fromSource(ClassWithNestedProperties.NestedChildClass.class));
assertThat(metadata) assertThat(metadata).has(Metadata
.has(Metadata .withProperty("nestedChildProps.child-class-property", Integer.class)
.withProperty("nestedChildProps.child-class-property", .fromSource(ClassWithNestedProperties.NestedChildClass.class)
Integer.class) .withDefaultValue(20));
.fromSource(ClassWithNestedProperties.NestedChildClass.class) assertThat(metadata).has(Metadata
.withDefaultValue(20)); .withProperty("nestedChildProps.parent-class-property", Integer.class)
assertThat(metadata) .fromSource(ClassWithNestedProperties.NestedChildClass.class)
.has(Metadata .withDefaultValue(10));
.withProperty("nestedChildProps.parent-class-property",
Integer.class)
.fromSource(ClassWithNestedProperties.NestedChildClass.class)
.withDefaultValue(10));
} }
@Test @Test

@ -61,7 +61,7 @@ public class JsonMarshallerTests {
new ItemHint.ValueProvider("first", new ItemHint.ValueProvider("first",
Collections.<String, Object>singletonMap("target", Collections.<String, Object>singletonMap("target",
"foo")), "foo")),
new ItemHint.ValueProvider("second", null)))); new ItemHint.ValueProvider("second", null))));
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
JsonMarshaller marshaller = new JsonMarshaller(); JsonMarshaller marshaller = new JsonMarshaller();
marshaller.write(metadata, outputStream); marshaller.write(metadata, outputStream);

@ -320,7 +320,8 @@ public class SpringBootPluginExtension {
* Module Layout. * Module Layout.
* @deprecated as of 1.5 in favor of a custom {@link LayoutFactory} * @deprecated as of 1.5 in favor of a custom {@link LayoutFactory}
*/ */
@Deprecated MODULE(new Layouts.Module()), @Deprecated
MODULE(new Layouts.Module()),
/** /**
* No layout. * No layout.

@ -273,7 +273,7 @@ public class Repackager {
private void repackage(JarFile sourceJar, JarWriter writer, private void repackage(JarFile sourceJar, JarWriter writer,
final List<Library> unpackLibraries, final List<Library> standardLibraries) final List<Library> unpackLibraries, final List<Library> standardLibraries)
throws IOException { throws IOException {
writer.writeManifest(buildManifest(sourceJar)); writer.writeManifest(buildManifest(sourceJar));
Set<String> seen = new HashSet<String>(); Set<String> seen = new HashSet<String>();
writeNestedLibraries(unpackLibraries, seen, writer); writeNestedLibraries(unpackLibraries, seen, writer);

@ -64,8 +64,8 @@ public class RandomAccessDataFile implements RandomAccessData {
throw new IllegalArgumentException("File must not be null"); throw new IllegalArgumentException("File must not be null");
} }
if (!file.exists()) { if (!file.exists()) {
throw new IllegalArgumentException(String.format( throw new IllegalArgumentException(
"File %s must exist", file.getAbsolutePath())); String.format("File %s must exist", file.getAbsolutePath()));
} }
this.file = file; this.file = file;
this.filePool = new FilePool(file, concurrentReads); this.filePool = new FilePool(file, concurrentReads);

@ -108,7 +108,7 @@ public class JarFile extends java.util.jar.JarFile {
private JarFile(RandomAccessDataFile rootFile, String pathFromRoot, private JarFile(RandomAccessDataFile rootFile, String pathFromRoot,
RandomAccessData data, JarEntryFilter filter, JarFileType type) RandomAccessData data, JarEntryFilter filter, JarFileType type)
throws IOException { throws IOException {
super(rootFile.getFile()); super(rootFile.getFile());
this.rootFile = rootFile; this.rootFile = rootFile;
this.pathFromRoot = pathFromRoot; this.pathFromRoot = pathFromRoot;

@ -125,11 +125,9 @@ public class JarFileArchiveTests {
File nested = new File(this.archive File nested = new File(this.archive
.getNestedArchive(getEntriesMap(this.archive).get("nested.jar")).getUrl() .getNestedArchive(getEntriesMap(this.archive).get("nested.jar")).getUrl()
.toURI()); .toURI());
File anotherNested = new File( File anotherNested = new File(this.archive
this.archive .getNestedArchive(getEntriesMap(this.archive).get("another-nested.jar"))
.getNestedArchive( .getUrl().toURI());
getEntriesMap(this.archive).get("another-nested.jar"))
.getUrl().toURI());
assertThat(nested.getParent()).isEqualTo(anotherNested.getParent()); assertThat(nested.getParent()).isEqualTo(anotherNested.getParent());
} }

@ -355,7 +355,8 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
* Module Layout. * Module Layout.
* @deprecated as of 1.5 in favor of a custom {@link LayoutFactory} * @deprecated as of 1.5 in favor of a custom {@link LayoutFactory}
*/ */
@Deprecated MODULE(new Layouts.Module()), @Deprecated
MODULE(new Layouts.Module()),
/** /**
* No Layout. * No Layout.

@ -73,7 +73,7 @@ public abstract class JsonObjectDeserializer<T>
*/ */
protected abstract T deserializeObject(JsonParser jsonParser, protected abstract T deserializeObject(JsonParser jsonParser,
DeserializationContext context, ObjectCodec codec, JsonNode tree) DeserializationContext context, ObjectCodec codec, JsonNode tree)
throws IOException; throws IOException;
/** /**
* Helper method to extract a value from the given {@code jsonNode} or return * Helper method to extract a value from the given {@code jsonNode} or return

@ -50,7 +50,7 @@ public class ApplicationContextHeaderFilter extends OncePerRequestFilter {
@Override @Override
protected void doFilterInternal(HttpServletRequest request, protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response, FilterChain filterChain) HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException { throws ServletException, IOException {
response.addHeader(HEADER_NAME, this.applicationContext.getId()); response.addHeader(HEADER_NAME, this.applicationContext.getId());
filterChain.doFilter(request, response); filterChain.doFilter(request, response);
} }

@ -86,7 +86,7 @@ public class ErrorPageFilter implements Filter, ErrorPageRegistry {
@Override @Override
protected void doFilterInternal(HttpServletRequest request, protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response, FilterChain chain) HttpServletResponse response, FilterChain chain)
throws ServletException, IOException { throws ServletException, IOException {
ErrorPageFilter.this.doFilter(request, response, chain); ErrorPageFilter.this.doFilter(request, response, chain);
} }
@ -134,7 +134,7 @@ public class ErrorPageFilter implements Filter, ErrorPageRegistry {
private void handleErrorStatus(HttpServletRequest request, private void handleErrorStatus(HttpServletRequest request,
HttpServletResponse response, int status, String message) HttpServletResponse response, int status, String message)
throws ServletException, IOException { throws ServletException, IOException {
if (response.isCommitted()) { if (response.isCommitted()) {
handleCommittedResponse(request, null); handleCommittedResponse(request, null);
return; return;
@ -151,7 +151,7 @@ public class ErrorPageFilter implements Filter, ErrorPageRegistry {
private void handleException(HttpServletRequest request, HttpServletResponse response, private void handleException(HttpServletRequest request, HttpServletResponse response,
ErrorWrapperResponse wrapped, Throwable ex) ErrorWrapperResponse wrapped, Throwable ex)
throws IOException, ServletException { throws IOException, ServletException {
Class<?> type = ex.getClass(); Class<?> type = ex.getClass();
String errorPath = getErrorPath(type); String errorPath = getErrorPath(type);
if (errorPath == null) { if (errorPath == null) {
@ -168,7 +168,7 @@ public class ErrorPageFilter implements Filter, ErrorPageRegistry {
private void forwardToErrorPage(String path, HttpServletRequest request, private void forwardToErrorPage(String path, HttpServletRequest request,
HttpServletResponse response, Throwable ex) HttpServletResponse response, Throwable ex)
throws ServletException, IOException { throws ServletException, IOException {
if (logger.isErrorEnabled()) { if (logger.isErrorEnabled()) {
String message = "Forwarding to error page from request " String message = "Forwarding to error page from request "
+ getDescription(request) + " due to exception [" + ex.getMessage() + getDescription(request) + " due to exception [" + ex.getMessage()

@ -1124,13 +1124,13 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
protected String getResponse(String url, protected String getResponse(String url,
HttpComponentsClientHttpRequestFactory requestFactory, String... headers) HttpComponentsClientHttpRequestFactory requestFactory, String... headers)
throws IOException, URISyntaxException { throws IOException, URISyntaxException {
return getResponse(url, HttpMethod.GET, requestFactory, headers); return getResponse(url, HttpMethod.GET, requestFactory, headers);
} }
protected String getResponse(String url, HttpMethod method, protected String getResponse(String url, HttpMethod method,
HttpComponentsClientHttpRequestFactory requestFactory, String... headers) HttpComponentsClientHttpRequestFactory requestFactory, String... headers)
throws IOException, URISyntaxException { throws IOException, URISyntaxException {
ClientHttpResponse response = getClientResponse(url, method, requestFactory, ClientHttpResponse response = getClientResponse(url, method, requestFactory,
headers); headers);
try { try {
@ -1162,7 +1162,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
protected ClientHttpResponse getClientResponse(String url, HttpMethod method, protected ClientHttpResponse getClientResponse(String url, HttpMethod method,
HttpComponentsClientHttpRequestFactory requestFactory, String... headers) HttpComponentsClientHttpRequestFactory requestFactory, String... headers)
throws IOException, URISyntaxException { throws IOException, URISyntaxException {
ClientHttpRequest request = requestFactory.createRequest(new URI(url), method); ClientHttpRequest request = requestFactory.createRequest(new URI(url), method);
request.getHeaders().add("Cookie", "JSESSIONID=" + "123"); request.getHeaders().add("Cookie", "JSESSIONID=" + "123");
for (String header : headers) { for (String header : headers) {

@ -199,7 +199,7 @@ public class JsonObjectDeserializerTests {
@Override @Override
protected T deserializeObject(JsonParser jsonParser, protected T deserializeObject(JsonParser jsonParser,
DeserializationContext context, ObjectCodec codec, JsonNode tree) DeserializationContext context, ObjectCodec codec, JsonNode tree)
throws IOException { throws IOException {
return null; return null;
} }

@ -49,7 +49,7 @@ public class NameAndAgeJsonComponent {
@Override @Override
protected NameAndAge deserializeObject(JsonParser jsonParser, protected NameAndAge deserializeObject(JsonParser jsonParser,
DeserializationContext context, ObjectCodec codec, JsonNode tree) DeserializationContext context, ObjectCodec codec, JsonNode tree)
throws IOException { throws IOException {
String name = nullSafeValue(tree.get("name"), String.class); String name = nullSafeValue(tree.get("name"), String.class);
Integer age = nullSafeValue(tree.get("age"), Integer.class); Integer age = nullSafeValue(tree.get("age"), Integer.class);
return new NameAndAge(name, age); return new NameAndAge(name, age);

@ -30,9 +30,8 @@ public class TestServlet extends HttpServlet {
@Override @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException { throws ServletException, IOException {
resp.getWriter() resp.getWriter().print(
.print(((String) req.getServletContext() ((String) req.getServletContext().getAttribute("listenerAttribute")) + " "
.getAttribute("listenerAttribute")) + " "
+ req.getAttribute("filterAttribute")); + req.getAttribute("filterAttribute"));
resp.getWriter().flush(); resp.getWriter().flush();
} }

Loading…
Cancel
Save