diff --git a/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java b/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java index 3e9247bf29..6552c5d18d 100644 --- a/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java +++ b/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java @@ -195,7 +195,6 @@ public class HttpComponentsClientHttpRequestFactory implements ClientHttpRequest @Override - @SuppressWarnings("deprecation") public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException { HttpClient client = getHttpClient(); Assert.state(client != null, "Synchronous execution requires an HttpClient to be set"); diff --git a/spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java index 7fba5dae85..44491be00f 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/FormHttpMessageConverter.java @@ -27,7 +27,6 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Random; import javax.mail.internet.MimeUtility; import org.springframework.core.io.Resource; @@ -99,8 +98,6 @@ public class FormHttpMessageConverter implements HttpMessageConverter> partConverters = new ArrayList>(); - private final Random random = new Random(); - public FormHttpMessageConverter() { this.supportedMediaTypes.add(MediaType.APPLICATION_FORM_URLENCODED); diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.java b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.java index eab44a1840..31a7fd79b5 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.java +++ b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilder.java @@ -465,6 +465,7 @@ public class Jackson2ObjectMapperBuilder { * @see #modulesToInstall(Module...) * @see com.fasterxml.jackson.databind.Module */ + @SuppressWarnings("unchecked") public Jackson2ObjectMapperBuilder modulesToInstall(Class... modules) { this.moduleClasses = modules; this.findWellKnownModules = true; @@ -712,7 +713,6 @@ public class Jackson2ObjectMapperBuilder { * Obtain a {@link Jackson2ObjectMapperBuilder} instance in order to * build an {@link XmlMapper} instance. */ - @SuppressWarnings("unchecked") public static Jackson2ObjectMapperBuilder xml() { return new Jackson2ObjectMapperBuilder().createXmlMapper(true); } diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java index df61ee49be..bf51310b34 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java +++ b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java @@ -348,6 +348,7 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean... modules) { this.builder.modulesToInstall(modules); } @@ -391,7 +392,6 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBeanCan be used for tools that support substition with {@code System.getProperty} + *

Can be used for tools that support substitution with {@code System.getProperty} * values, like log4j's "${key}" syntax within log file locations. * @param servletContext the servlet context of the web application * @throws IllegalStateException if the system property is already set, diff --git a/spring-web/src/test/java/org/springframework/http/CacheControlTests.java b/spring-web/src/test/java/org/springframework/http/CacheControlTests.java index 66a8a7a4b3..43de2c0b43 100644 --- a/spring-web/src/test/java/org/springframework/http/CacheControlTests.java +++ b/spring-web/src/test/java/org/springframework/http/CacheControlTests.java @@ -28,8 +28,6 @@ import java.util.concurrent.TimeUnit; */ public class CacheControlTests { - private static final String CACHE_CONTROL_HEADER = "Cache-Control"; - @Test public void emptyCacheControl() throws Exception { CacheControl cc = CacheControl.empty(); diff --git a/spring-web/src/test/java/org/springframework/http/converter/json/GsonFactoryBeanTests.java b/spring-web/src/test/java/org/springframework/http/converter/json/GsonFactoryBeanTests.java index 382a291cee..c3918e0a7b 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/json/GsonFactoryBeanTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/json/GsonFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -20,6 +20,7 @@ import java.util.Calendar; import java.util.Date; import com.google.gson.Gson; + import org.junit.Test; import static org.junit.Assert.*; @@ -172,6 +173,7 @@ public class GsonFactoryBeanTests { private String name; + @SuppressWarnings("unused") public String getName() { return this.name; } @@ -186,6 +188,7 @@ public class GsonFactoryBeanTests { private Date date; + @SuppressWarnings("unused") public Date getDate() { return this.date; } @@ -200,6 +203,7 @@ public class GsonFactoryBeanTests { private byte[] bytes; + @SuppressWarnings("unused") public byte[] getBytes() { return this.bytes; } diff --git a/spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilderTests.java b/spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilderTests.java index 3e80756f61..811fdbe95c 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilderTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilderTests.java @@ -60,6 +60,7 @@ import com.fasterxml.jackson.databind.ser.std.ClassSerializer; import com.fasterxml.jackson.databind.ser.std.NumberSerializer; import com.fasterxml.jackson.databind.type.SimpleType; import com.fasterxml.jackson.dataformat.xml.XmlMapper; + import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.junit.Test; @@ -143,26 +144,25 @@ public class Jackson2ObjectMapperBuilderTests { @Test public void setNotNullSerializationInclusion() { ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().build(); - assertTrue(objectMapper.getSerializationConfig().getSerializationInclusion() == - JsonInclude.Include.ALWAYS); + assertSame(JsonInclude.Include.ALWAYS, objectMapper.getSerializationConfig().getSerializationInclusion()); objectMapper = Jackson2ObjectMapperBuilder.json().serializationInclusion(JsonInclude.Include.NON_NULL).build(); - assertTrue(objectMapper.getSerializationConfig().getSerializationInclusion() == JsonInclude.Include.NON_NULL); + assertSame(JsonInclude.Include.NON_NULL, objectMapper.getSerializationConfig().getSerializationInclusion()); } @Test public void setNotDefaultSerializationInclusion() { ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().build(); - assertTrue(objectMapper.getSerializationConfig().getSerializationInclusion() == JsonInclude.Include.ALWAYS); + assertSame(JsonInclude.Include.ALWAYS, objectMapper.getSerializationConfig().getSerializationInclusion()); objectMapper = Jackson2ObjectMapperBuilder.json().serializationInclusion(JsonInclude.Include.NON_DEFAULT).build(); - assertTrue(objectMapper.getSerializationConfig().getSerializationInclusion() == JsonInclude.Include.NON_DEFAULT); + assertSame(JsonInclude.Include.NON_DEFAULT, objectMapper.getSerializationConfig().getSerializationInclusion()); } @Test public void setNotEmptySerializationInclusion() { ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().build(); - assertTrue(objectMapper.getSerializationConfig().getSerializationInclusion() == JsonInclude.Include.ALWAYS); + assertSame(JsonInclude.Include.ALWAYS, objectMapper.getSerializationConfig().getSerializationInclusion()); objectMapper = Jackson2ObjectMapperBuilder.json().serializationInclusion(JsonInclude.Include.NON_EMPTY).build(); - assertTrue(objectMapper.getSerializationConfig().getSerializationInclusion() == JsonInclude.Include.NON_EMPTY); + assertSame(JsonInclude.Include.NON_EMPTY, objectMapper.getSerializationConfig().getSerializationInclusion()); } @Test @@ -213,26 +213,27 @@ public class Jackson2ObjectMapperBuilderTests { @Test public void modules() { - NumberSerializer serializer1 = new NumberSerializer(); + NumberSerializer serializer1 = new NumberSerializer(Integer.class); SimpleModule module = new SimpleModule(); module.addSerializer(Integer.class, serializer1); ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().modules(module).build(); Serializers serializers = getSerializerFactoryConfig(objectMapper).serializers().iterator().next(); - assertTrue(serializers.findSerializer(null, SimpleType.construct(Integer.class), null) == serializer1); + assertSame(serializer1, serializers.findSerializer(null, SimpleType.construct(Integer.class), null)); } @Test + @SuppressWarnings("unchecked") public void modulesToInstallByClass() { ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().modulesToInstall(CustomIntegerModule.class).build(); Serializers serializers = getSerializerFactoryConfig(objectMapper).serializers().iterator().next(); - assertTrue(serializers.findSerializer(null, SimpleType.construct(Integer.class), null).getClass() == CustomIntegerSerializer.class); + assertSame(CustomIntegerSerializer.class, serializers.findSerializer(null, SimpleType.construct(Integer.class), null).getClass()); } @Test public void modulesToInstallByInstance() { ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().modulesToInstall(new CustomIntegerModule()).build(); Serializers serializers = getSerializerFactoryConfig(objectMapper).serializers().iterator().next(); - assertTrue(serializers.findSerializer(null, SimpleType.construct(Integer.class), null).getClass() == CustomIntegerSerializer.class); + assertSame(CustomIntegerSerializer.class, serializers.findSerializer(null, SimpleType.construct(Integer.class), null).getClass()); } @Test @@ -257,6 +258,7 @@ public class Jackson2ObjectMapperBuilderTests { } @Test // SPR-12634 + @SuppressWarnings("unchecked") public void customizeDefaultModulesWithModuleClass() throws JsonProcessingException, UnsupportedEncodingException { ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().modulesToInstall(CustomIntegerModule.class).build(); DateTime dateTime = new DateTime(1322903730000L, DateTimeZone.UTC); @@ -292,13 +294,13 @@ public class Jackson2ObjectMapperBuilderTests { @Test public void serializerByType() { - JsonSerializer serializer = new NumberSerializer(); + JsonSerializer serializer = new NumberSerializer(Integer.class); ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json() .modules(new ArrayList<>()) // Disable well-known modules detection .serializerByType(Boolean.class, serializer).build(); assertTrue(getSerializerFactoryConfig(objectMapper).hasSerializers()); Serializers serializers = getSerializerFactoryConfig(objectMapper).serializers().iterator().next(); - assertTrue(serializers.findSerializer(null, SimpleType.construct(Boolean.class), null) == serializer); + assertSame(serializer, serializers.findSerializer(null, SimpleType.construct(Boolean.class), null)); } @Test @@ -309,7 +311,7 @@ public class Jackson2ObjectMapperBuilderTests { .deserializerByType(Date.class, deserializer).build(); assertTrue(getDeserializerFactoryConfig(objectMapper).hasDeserializers()); Deserializers deserializers = getDeserializerFactoryConfig(objectMapper).deserializers().iterator().next(); - assertTrue(deserializers.findBeanDeserializer(SimpleType.construct(Date.class), null, null) == deserializer); + assertSame(deserializer, deserializers.findBeanDeserializer(SimpleType.construct(Date.class), null, null)); } @Test @@ -362,7 +364,7 @@ public class Jackson2ObjectMapperBuilderTests { deserializerMap.put(Date.class, deserializer); JsonSerializer> serializer1 = new ClassSerializer(); - JsonSerializer serializer2 = new NumberSerializer(); + JsonSerializer serializer2 = new NumberSerializer(Integer.class); Jackson2ObjectMapperBuilder builder = Jackson2ObjectMapperBuilder.json() .modules(new ArrayList<>()) // Disable well-known modules detection @@ -387,15 +389,15 @@ public class Jackson2ObjectMapperBuilderTests { assertTrue(getDeserializerFactoryConfig(objectMapper).hasDeserializers()); Serializers serializers = getSerializerFactoryConfig(objectMapper).serializers().iterator().next(); - assertTrue(serializers.findSerializer(null, SimpleType.construct(Class.class), null) == serializer1); - assertTrue(serializers.findSerializer(null, SimpleType.construct(Boolean.class), null) == serializer2); + assertSame(serializer1, serializers.findSerializer(null, SimpleType.construct(Class.class), null)); + assertSame(serializer2, serializers.findSerializer(null, SimpleType.construct(Boolean.class), null)); assertNull(serializers.findSerializer(null, SimpleType.construct(Number.class), null)); Deserializers deserializers = getDeserializerFactoryConfig(objectMapper).deserializers().iterator().next(); - assertTrue(deserializers.findBeanDeserializer(SimpleType.construct(Date.class), null, null) == deserializer); + assertSame(deserializer, deserializers.findBeanDeserializer(SimpleType.construct(Date.class), null, null)); - assertTrue(annotationIntrospector == objectMapper.getSerializationConfig().getAnnotationIntrospector()); - assertTrue(annotationIntrospector == objectMapper.getDeserializationConfig().getAnnotationIntrospector()); + assertSame(annotationIntrospector, objectMapper.getSerializationConfig().getAnnotationIntrospector()); + assertSame(annotationIntrospector, objectMapper.getDeserializationConfig().getAnnotationIntrospector()); assertTrue(objectMapper.getSerializationConfig().isEnabled(SerializationFeature.FAIL_ON_EMPTY_BEANS)); assertTrue(objectMapper.getDeserializationConfig().isEnabled(DeserializationFeature.UNWRAP_ROOT_VALUE)); @@ -408,7 +410,7 @@ public class Jackson2ObjectMapperBuilderTests { assertFalse(objectMapper.getDeserializationConfig().isEnabled(MapperFeature.AUTO_DETECT_FIELDS)); assertFalse(objectMapper.getFactory().isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE)); assertFalse(objectMapper.getFactory().isEnabled(JsonGenerator.Feature.QUOTE_FIELD_NAMES)); - assertTrue(objectMapper.getSerializationConfig().getSerializationInclusion() == JsonInclude.Include.NON_NULL); + assertSame(JsonInclude.Include.NON_NULL, objectMapper.getSerializationConfig().getSerializationInclusion()); } @Test diff --git a/spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBeanTests.java b/spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBeanTests.java index 31b028c995..a9864218c6 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBeanTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBeanTests.java @@ -222,7 +222,7 @@ public class Jackson2ObjectMapperFactoryBeanTests { @Test public void setModules() { - NumberSerializer serializer1 = new NumberSerializer(); + NumberSerializer serializer1 = new NumberSerializer(Integer.class); SimpleModule module = new SimpleModule(); module.addSerializer(Integer.class, serializer1); @@ -341,7 +341,7 @@ public class Jackson2ObjectMapperFactoryBeanTests { deserializers.put(Date.class, new DateDeserializer()); JsonSerializer> serializer1 = new ClassSerializer(); - JsonSerializer serializer2 = new NumberSerializer(); + JsonSerializer serializer2 = new NumberSerializer(Integer.class); factory.setModules(new ArrayList<>()); // Disable well-known modules detection factory.setSerializers(serializer1); diff --git a/spring-web/src/test/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverterTests.java index 59aff6cf77..589f751c71 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverterTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverterTests.java @@ -31,6 +31,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ser.FilterProvider; import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; + import org.junit.Test; import org.springframework.core.ParameterizedTypeReference; @@ -395,6 +396,7 @@ public class MappingJackson2HttpMessageConverterTests { private interface MyJacksonView1 {}; private interface MyJacksonView2 {}; + @SuppressWarnings("unused") private static class JacksonViewBean { @JsonView(MyJacksonView1.class) @@ -431,6 +433,7 @@ public class MappingJackson2HttpMessageConverterTests { } @JsonFilter("myJacksonFilter") + @SuppressWarnings("unused") private static class JacksonFilteredBean { private String property1; diff --git a/spring-web/src/test/java/org/springframework/http/converter/json/SpringHandlerInstantiatorTests.java b/spring-web/src/test/java/org/springframework/http/converter/json/SpringHandlerInstantiatorTests.java index 7b24d78ed5..6cd0848a99 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/json/SpringHandlerInstantiatorTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/json/SpringHandlerInstantiatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -106,13 +106,13 @@ public class SpringHandlerInstantiatorTests { @Test public void applicationContextAwaretypeResolverBuilder() throws JsonProcessingException { - this.objectMapper.writeValueAsString(new Group("authors")); + this.objectMapper.writeValueAsString(new Group()); assertTrue(CustomTypeResolverBuilder.isAutowiredFiledInitialized); } @Test public void applicationContextAwareTypeIdResolver() throws JsonProcessingException { - this.objectMapper.writeValueAsString(new Group("authors")); + this.objectMapper.writeValueAsString(new Group()); assertTrue(CustomTypeIdResolver.isAutowiredFiledInitialized); } @@ -261,15 +261,6 @@ public class SpringHandlerInstantiatorTests { @JsonTypeIdResolver(CustomTypeIdResolver.class) public static class Group { - private String name; - - public Group(String name) { - this.name = name; - } - - public Group() { - } - public String getType() { return Group.class.getName(); } diff --git a/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverterTests.java index 062d50ada4..3af300d77a 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverterTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverterTests.java @@ -45,7 +45,6 @@ import static org.junit.Assert.*; * @author Arjen Poutsma * @author Rossen Stoyanchev */ -@SuppressWarnings("unused") public class Jaxb2CollectionHttpMessageConverterTests { private Jaxb2CollectionHttpMessageConverter converter; diff --git a/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTests.java index fff213409d..ecfbacaa0d 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTests.java @@ -53,7 +53,6 @@ import static org.junit.Assert.assertTrue; * @author Sebastien Deleuze * @author Rossen Stoyanchev */ -@SuppressWarnings("unused") public class Jaxb2RootElementHttpMessageConverterTests { private Jaxb2RootElementHttpMessageConverter converter; diff --git a/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerFactoryBeanIntegrationTests.java b/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerFactoryBeanIntegrationTests.java index 46f712ca87..f0dc202ab5 100644 --- a/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerFactoryBeanIntegrationTests.java +++ b/spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpInvokerFactoryBeanIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -42,6 +42,7 @@ import static org.junit.Assert.*; public class HttpInvokerFactoryBeanIntegrationTests { @Test + @SuppressWarnings("resource") public void testLoadedConfigClass() { ApplicationContext context = new AnnotationConfigApplicationContext(InvokerAutowiringConfig.class); MyBean myBean = context.getBean("myBean", MyBean.class); @@ -51,6 +52,7 @@ public class HttpInvokerFactoryBeanIntegrationTests { } @Test + @SuppressWarnings("resource") public void testNonLoadedConfigClass() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.registerBeanDefinition("config", new RootBeanDefinition(InvokerAutowiringConfig.class.getName())); @@ -62,6 +64,7 @@ public class HttpInvokerFactoryBeanIntegrationTests { } @Test + @SuppressWarnings("resource") public void withConfigurationClassWithPlainFactoryBean() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(ConfigWithPlainFactoryBean.class); @@ -133,7 +136,7 @@ public class HttpInvokerFactoryBeanIntegrationTests { } @Bean - public FactoryBean myService() { + public HttpInvokerProxyFactoryBean myService() { String name = env.getProperty("testbean.name"); HttpInvokerProxyFactoryBean factory = new HttpInvokerProxyFactoryBean(); factory.setServiceUrl("/svc/" + name); diff --git a/spring-web/src/test/java/org/springframework/web/context/request/RequestAndSessionScopedBeanTests.java b/spring-web/src/test/java/org/springframework/web/context/request/RequestAndSessionScopedBeanTests.java index de7e9f7fa9..353a879fcc 100644 --- a/spring-web/src/test/java/org/springframework/web/context/request/RequestAndSessionScopedBeanTests.java +++ b/spring-web/src/test/java/org/springframework/web/context/request/RequestAndSessionScopedBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 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. @@ -36,6 +36,7 @@ import static org.junit.Assert.*; public class RequestAndSessionScopedBeanTests { @Test + @SuppressWarnings("resource") public void testPutBeanInRequest() throws Exception { String targetBeanName = "target"; @@ -75,6 +76,7 @@ public class RequestAndSessionScopedBeanTests { } @Test + @SuppressWarnings("resource") public void testPutBeanInSession() throws Exception { String targetBeanName = "target"; HttpServletRequest request = new MockHttpServletRequest(); diff --git a/spring-web/src/test/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContextTests.java b/spring-web/src/test/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContextTests.java index 93e647e823..be74d09254 100644 --- a/spring-web/src/test/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContextTests.java +++ b/spring-web/src/test/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -34,6 +34,7 @@ import static org.junit.Assert.*; public class AnnotationConfigWebApplicationContextTests { @Test + @SuppressWarnings("resource") public void registerSingleClass() { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(Config.class); @@ -44,6 +45,7 @@ public class AnnotationConfigWebApplicationContextTests { } @Test + @SuppressWarnings("resource") public void configLocationWithSingleClass() { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.setConfigLocation(Config.class.getName()); @@ -54,6 +56,7 @@ public class AnnotationConfigWebApplicationContextTests { } @Test + @SuppressWarnings("resource") public void configLocationWithBasePackage() { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.setConfigLocation("org.springframework.web.context.support"); @@ -64,6 +67,7 @@ public class AnnotationConfigWebApplicationContextTests { } @Test + @SuppressWarnings("resource") public void withBeanNameGenerator() { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.setBeanNameGenerator(new AnnotationBeanNameGenerator() { diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/ExpressionValueMethodArgumentResolverTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/ExpressionValueMethodArgumentResolverTests.java index cbc2ae7d15..5606eececf 100644 --- a/spring-web/src/test/java/org/springframework/web/method/annotation/ExpressionValueMethodArgumentResolverTests.java +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/ExpressionValueMethodArgumentResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 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. @@ -51,6 +51,7 @@ public class ExpressionValueMethodArgumentResolverTests { private NativeWebRequest webRequest; @Before + @SuppressWarnings("resource") public void setUp() throws Exception { GenericWebApplicationContext context = new GenericWebApplicationContext(); context.refresh(); diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelFactoryOrderingTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelFactoryOrderingTests.java index a177b7e864..793cc67d50 100644 --- a/spring-web/src/test/java/org/springframework/web/method/annotation/ModelFactoryOrderingTests.java +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/ModelFactoryOrderingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -168,7 +168,6 @@ public class ModelFactoryOrderingTests { } } - @SuppressWarnings("unused") private static class StraightLineDependencyController extends AbstractController { @ModelAttribute @@ -208,7 +207,6 @@ public class ModelFactoryOrderingTests { } } - @SuppressWarnings("unused") private static class TreeDependencyController extends AbstractController { @ModelAttribute @@ -247,7 +245,6 @@ public class ModelFactoryOrderingTests { } } - @SuppressWarnings("unused") private static class InvertedTreeDependencyController extends AbstractController { @ModelAttribute @@ -287,7 +284,6 @@ public class ModelFactoryOrderingTests { } - @SuppressWarnings("unused") private static class UnresolvedDependencyController extends AbstractController { @ModelAttribute diff --git a/spring-web/src/test/java/org/springframework/web/method/annotation/RequestHeaderMethodArgumentResolverTests.java b/spring-web/src/test/java/org/springframework/web/method/annotation/RequestHeaderMethodArgumentResolverTests.java index ecf30430ee..b484e2ff0d 100644 --- a/spring-web/src/test/java/org/springframework/web/method/annotation/RequestHeaderMethodArgumentResolverTests.java +++ b/spring-web/src/test/java/org/springframework/web/method/annotation/RequestHeaderMethodArgumentResolverTests.java @@ -58,6 +58,7 @@ public class RequestHeaderMethodArgumentResolverTests { @Before + @SuppressWarnings("resource") public void setUp() throws Exception { GenericWebApplicationContext context = new GenericWebApplicationContext(); context.refresh(); diff --git a/spring-web/src/test/java/org/springframework/web/method/support/CompositeUriComponentsContributorTests.java b/spring-web/src/test/java/org/springframework/web/method/support/CompositeUriComponentsContributorTests.java index 55aa9d9f12..7a7b3abcae 100644 --- a/spring-web/src/test/java/org/springframework/web/method/support/CompositeUriComponentsContributorTests.java +++ b/spring-web/src/test/java/org/springframework/web/method/support/CompositeUriComponentsContributorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -57,7 +57,6 @@ public class CompositeUriComponentsContributorTests { } - @SuppressWarnings("unused") public void handleRequest(@RequestParam String p1, String p2, @RequestHeader String h) { } diff --git a/spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.java b/spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.java index 8a9a12e0a4..b305c833f4 100644 --- a/spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.java +++ b/spring-web/src/test/java/org/springframework/web/multipart/commons/CommonsMultipartResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -111,6 +111,8 @@ public class CommonsMultipartResolverTests { doTestFiles(request); doTestBinding(resolver, originalRequest, request); + + wac.close(); } private void doTestParameters(MultipartHttpServletRequest request) {