Browse Source

Clean up warnings across code base

pull/1287/head
Sam Brannen 9 years ago
parent
commit
9ed66bf2eb
  1. 27
      spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/GenericInterfaceDrivenDependencyInjectionAspect.aj
  2. 1
      spring-aspects/src/test/java/org/springframework/aop/aspectj/autoproxy/CodeStyleAspect.aj
  3. 17
      spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/XmlBeanConfigurerTests.java
  4. 14
      spring-aspects/src/test/java/org/springframework/context/annotation/aspectj/AnnotationBeanConfigurerTests.java
  5. 1
      spring-core/src/main/java/org/springframework/core/codec/AbstractEncoder.java
  6. 3
      spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java
  7. 3
      spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AnnotationExceptionHandlerMethodResolver.java
  8. 3
      spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/BufferingStompDecoderTests.java
  9. 3
      spring-messaging/src/test/java/org/springframework/messaging/simp/user/UserDestinationMessageHandlerTests.java
  10. 16
      spring-orm/src/test/java/org/springframework/orm/jpa/hibernate/HibernateEntityManagerFactoryIntegrationTests.java
  11. 4
      spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java
  12. 3
      spring-oxm/src/main/java/org/springframework/oxm/support/AbstractMarshaller.java
  13. 3
      spring-oxm/src/test/java/org/springframework/oxm/config/OxmNamespaceHandlerTests.java
  14. 7
      spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java
  15. 27
      spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java
  16. 119
      spring-tx/src/test/java/org/springframework/transaction/support/SimpleTransactionScopeTests.java
  17. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyExtractors.java
  18. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/resource/ContentVersionStrategy.java
  19. 4
      spring-web-reactive/src/main/java/org/springframework/web/reactive/resource/ResourceTransformerChain.java
  20. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolver.java
  21. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java
  22. 5
      spring-web-reactive/src/main/java/org/springframework/web/reactive/socket/WebSocketHandler.java
  23. 3
      spring-web-reactive/src/test/java/org/springframework/web/reactive/config/ResourceHandlerRegistryTests.java
  24. 3
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/HttpMessageWriterViewTests.java
  25. 3
      spring-web/src/main/java/org/springframework/http/client/reactive/ReactorClientHttpConnector.java
  26. 3
      spring-web/src/main/java/org/springframework/http/codec/ResourceRegionHttpMessageWriter.java
  27. 3
      spring-web/src/main/java/org/springframework/http/codec/json/Jackson2JsonDecoder.java
  28. 5
      spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyHttpHandlerAdapter.java
  29. 3
      spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyServerHttpRequest.java
  30. 5
      spring-web/src/main/java/org/springframework/web/bind/support/WebExchangeDataBinder.java
  31. 4
      spring-web/src/main/java/org/springframework/web/context/request/async/TimeoutCallableProcessingInterceptor.java
  32. 4
      spring-web/src/main/java/org/springframework/web/cors/reactive/DefaultCorsProcessor.java
  33. 4
      spring-web/src/test/java/org/springframework/http/client/AbstractHttpRequestFactoryTestCase.java
  34. 13
      spring-web/src/test/java/org/springframework/http/server/reactive/ListenerReadPublisherTests.java
  35. 12
      spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java
  36. 3
      spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java
  37. 4
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ConsumesRequestCondition.java
  38. 3
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java
  39. 3
      spring-webmvc/src/main/java/org/springframework/web/servlet/support/WebContentGenerator.java
  40. 3
      spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltView.java
  41. 4
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/StreamingResponseBodyReturnValueHandlerTests.java
  42. 3
      spring-webmvc/src/test/java/org/springframework/web/servlet/resource/AppCacheManifestTransformerTests.java
  43. 14
      spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/RssFeedViewTests.java
  44. 3
      spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java
  45. 3
      spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/EventSourceTransportHandler.java
  46. 3
      spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/HtmlFileTransportHandler.java
  47. 3
      spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/XhrPollingTransportHandler.java
  48. 3
      spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/XhrStreamingTransportHandler.java
  49. 4
      spring-websocket/src/test/java/org/springframework/web/socket/messaging/StompSubProtocolHandlerTests.java
  50. 1
      spring-websocket/src/test/java/org/springframework/web/socket/messaging/WebSocketStompClientTests.java
  51. 1
      spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java

27
spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/GenericInterfaceDrivenDependencyInjectionAspect.aj

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2017 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.
@ -13,16 +13,18 @@ @@ -13,16 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.beans.factory.aspectj;
/**
* Generic-based dependency injection aspect.
* <p>
* This aspect allows users to implement efficient, type-safe dependency injection without
* the use of the &#64;Configurable annotation.
*
* The subaspect of this aspect doesn't need to include any AOP constructs.
* For example, here is a subaspect that configures the {@code PricingStrategyClient} objects.
* <p>This aspect allows users to implement efficient, type-safe dependency injection
* without the use of the {@code @Configurable} annotation.
*
* <p>The subaspect of this aspect doesn't need to include any AOP constructs. For
* example, here is a subaspect that configures the {@code PricingStrategyClient} objects.
*
* <pre class="code">
* aspect PricingStrategyDependencyInjectionAspect
* extends GenericInterfaceDrivenDependencyInjectionAspect<PricingStrategyClient> {
@ -35,20 +37,23 @@ package org.springframework.beans.factory.aspectj; @@ -35,20 +37,23 @@ package org.springframework.beans.factory.aspectj;
* public void setPricingStrategy(PricingStrategy pricingStrategy) {
* this.pricingStrategy = pricingStrategy;
* }
* }
* </pre>
* }</pre>
*
* @author Ramnivas Laddad
* @since 3.0.0
* @since 3.0
*/
public abstract aspect GenericInterfaceDrivenDependencyInjectionAspect<I> extends AbstractInterfaceDrivenDependencyInjectionAspect {
declare parents: I implements ConfigurableObject;
declare parents: I implements ConfigurableObject;
public pointcut inConfigurableBean() : within(I+);
@SuppressWarnings("unchecked")
public final void configureBean(Object bean) {
configure((I)bean);
configure((I) bean);
}
// Unfortunately, erasure used with generics won't allow to use the same named method
protected abstract void configure(I bean);
}

1
spring-aspects/src/test/java/org/springframework/aop/aspectj/autoproxy/CodeStyleAspect.aj

@ -23,6 +23,7 @@ import org.aspectj.lang.annotation.SuppressAjWarnings; @@ -23,6 +23,7 @@ import org.aspectj.lang.annotation.SuppressAjWarnings;
*/
public aspect CodeStyleAspect {
@SuppressWarnings("unused")
private String foo;
pointcut somePC() : call(* someMethod());

17
spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/XmlBeanConfigurerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2017 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.
@ -16,22 +16,25 @@ @@ -16,22 +16,25 @@
package org.springframework.beans.factory.aspectj;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import static org.junit.Assert.*;
/**
* @author Chris Beams
*/
public class XmlBeanConfigurerTests {
@Test
public void testInjection() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"org/springframework/beans/factory/aspectj/beanConfigurerTests.xml");
ShouldBeConfiguredBySpring myObject = new ShouldBeConfiguredBySpring();
Assert.assertEquals("Rod", myObject.getName());
public void injection() {
try (ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"org/springframework/beans/factory/aspectj/beanConfigurerTests.xml")) {
ShouldBeConfiguredBySpring myObject = new ShouldBeConfiguredBySpring();
assertEquals("Rod", myObject.getName());
}
}
}

14
spring-aspects/src/test/java/org/springframework/context/annotation/aspectj/AnnotationBeanConfigurerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2017 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.
@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
package org.springframework.context.annotation.aspectj;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.aspectj.ShouldBeConfiguredBySpring;
@ -24,6 +23,8 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext @@ -24,6 +23,8 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import static org.junit.Assert.*;
/**
* Tests that @EnableSpringConfigured properly registers an
* {@link org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect},
@ -35,10 +36,11 @@ import org.springframework.context.annotation.ImportResource; @@ -35,10 +36,11 @@ import org.springframework.context.annotation.ImportResource;
public class AnnotationBeanConfigurerTests {
@Test
public void testInjection() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
ShouldBeConfiguredBySpring myObject = new ShouldBeConfiguredBySpring();
Assert.assertEquals("Rod", myObject.getName());
public void injection() {
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class)) {
ShouldBeConfiguredBySpring myObject = new ShouldBeConfiguredBySpring();
assertEquals("Rod", myObject.getName());
}
}

1
spring-core/src/main/java/org/springframework/core/codec/AbstractEncoder.java

@ -18,7 +18,6 @@ package org.springframework.core.codec; @@ -18,7 +18,6 @@ package org.springframework.core.codec;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.springframework.core.ResolvableType;
import org.springframework.util.MimeType;

3
spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -1451,7 +1451,6 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { @@ -1451,7 +1451,6 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
@Override
@SuppressWarnings("rawtypes")
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
// Invocation on ConnectionProxy interface coming in...

3
spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/AnnotationExceptionHandlerMethodResolver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -27,7 +27,6 @@ import org.springframework.core.MethodIntrospector; @@ -27,7 +27,6 @@ import org.springframework.core.MethodIntrospector;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.messaging.handler.annotation.MessageExceptionHandler;
import org.springframework.messaging.handler.invocation.AbstractExceptionHandlerMethodResolver;
import org.springframework.util.ReflectionUtils.MethodFilter;
/**
* A sub-class of {@link AbstractExceptionHandlerMethodResolver} that looks for

3
spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/BufferingStompDecoderTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 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.
@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
package org.springframework.messaging.simp.stomp;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;

3
spring-messaging/src/test/java/org/springframework/messaging/simp/user/UserDestinationMessageHandlerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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,7 +20,6 @@ import static org.junit.Assert.*; @@ -20,7 +20,6 @@ import static org.junit.Assert.*;
import static org.mockito.BDDMockito.*;
import static org.springframework.messaging.simp.SimpMessageHeaderAccessor.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import org.junit.Before;

16
spring-orm/src/test/java/org/springframework/orm/jpa/hibernate/HibernateEntityManagerFactoryIntegrationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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,8 +20,6 @@ import javax.persistence.EntityManager; @@ -20,8 +20,6 @@ import javax.persistence.EntityManager;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.jpa.HibernateEntityManager;
import org.hibernate.jpa.HibernateEntityManagerFactory;
import org.junit.Test;
import org.springframework.aop.framework.ProxyFactory;
@ -50,13 +48,13 @@ public class HibernateEntityManagerFactoryIntegrationTests extends AbstractConta @@ -50,13 +48,13 @@ public class HibernateEntityManagerFactoryIntegrationTests extends AbstractConta
@Test
public void testCanCastNativeEntityManagerFactoryToHibernateEntityManagerFactoryImpl() {
EntityManagerFactoryInfo emfi = (EntityManagerFactoryInfo) entityManagerFactory;
assertTrue(emfi.getNativeEntityManagerFactory() instanceof HibernateEntityManagerFactory);
assertTrue(emfi.getNativeEntityManagerFactory() instanceof org.hibernate.jpa.HibernateEntityManagerFactory);
assertTrue(emfi.getNativeEntityManagerFactory() instanceof SessionFactory); // as of Hibernate 5.2
}
@Test
public void testCanCastSharedEntityManagerProxyToHibernateEntityManager() {
assertTrue(sharedEntityManager instanceof HibernateEntityManager);
assertTrue(sharedEntityManager instanceof org.hibernate.jpa.HibernateEntityManager);
assertTrue(((EntityManagerProxy) sharedEntityManager).getTargetEntityManager() instanceof Session); // as of Hibernate 5.2
}
@ -64,10 +62,10 @@ public class HibernateEntityManagerFactoryIntegrationTests extends AbstractConta @@ -64,10 +62,10 @@ public class HibernateEntityManagerFactoryIntegrationTests extends AbstractConta
public void testCanUnwrapAopProxy() {
EntityManager em = entityManagerFactory.createEntityManager();
EntityManager proxy = ProxyFactory.getProxy(EntityManager.class, new SingletonTargetSource(em));
assertTrue(em instanceof HibernateEntityManager);
assertFalse(proxy instanceof HibernateEntityManager);
assertTrue(proxy.unwrap(HibernateEntityManager.class) instanceof HibernateEntityManager);
assertSame(em, proxy.unwrap(HibernateEntityManager.class));
assertTrue(em instanceof org.hibernate.jpa.HibernateEntityManager);
assertFalse(proxy instanceof org.hibernate.jpa.HibernateEntityManager);
assertTrue(proxy.unwrap(org.hibernate.jpa.HibernateEntityManager.class) != null);
assertSame(em, proxy.unwrap(org.hibernate.jpa.HibernateEntityManager.class));
assertSame(em.getDelegate(), proxy.getDelegate());
}

4
spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -544,7 +544,6 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi @@ -544,7 +544,6 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
}
}
@SuppressWarnings("deprecation")
private Schema loadSchema(Resource[] resources, String schemaLanguage) throws IOException, SAXException {
if (logger.isDebugEnabled()) {
logger.debug("Setting validation schema to " +
@ -805,7 +804,6 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi @@ -805,7 +804,6 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
}
}
@SuppressWarnings("deprecation")
private Source processSource(Source source) {
if (StaxUtils.isStaxSource(source) || source instanceof DOMSource) {
return source;

3
spring-oxm/src/main/java/org/springframework/oxm/support/AbstractMarshaller.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -183,7 +183,6 @@ public abstract class AbstractMarshaller implements Marshaller, Unmarshaller { @@ -183,7 +183,6 @@ public abstract class AbstractMarshaller implements Marshaller, Unmarshaller {
* @return the XMLReader
* @throws SAXException if thrown by JAXP methods
*/
@SuppressWarnings("deprecation")
protected XMLReader createXmlReader() throws SAXException {
XMLReader xmlReader = org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
xmlReader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd());

3
spring-oxm/src/test/java/org/springframework/oxm/config/OxmNamespaceHandlerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -32,7 +32,6 @@ import static org.junit.Assert.*; @@ -32,7 +32,6 @@ import static org.junit.Assert.*;
* @author Jakub Narloch
* @author Sam Brannen
*/
@SuppressWarnings("deprecation")
public class OxmNamespaceHandlerTests {
private final ApplicationContext applicationContext =

7
spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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,9 +34,6 @@ import org.xml.sax.Attributes; @@ -34,9 +34,6 @@ import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xmlunit.diff.Comparison;
import org.xmlunit.diff.ComparisonResult;
import org.xmlunit.diff.ComparisonType;
import org.xmlunit.diff.DifferenceEvaluator;
import javax.activation.DataHandler;
@ -55,9 +52,7 @@ import java.io.StringWriter; @@ -55,9 +52,7 @@ import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

27
spring-oxm/src/test/java/org/springframework/oxm/xstream/XStreamMarshallerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -56,6 +56,7 @@ import java.util.Arrays; @@ -56,6 +56,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@ -69,6 +70,7 @@ import static org.xmlunit.matchers.CompareMatcher.isSimilarTo; @@ -69,6 +70,7 @@ import static org.xmlunit.matchers.CompareMatcher.isSimilarTo;
/**
* @author Arjen Poutsma
* @author Sam Brannen
*/
public class XStreamMarshallerTests {
@ -350,25 +352,20 @@ public class XStreamMarshallerTests { @@ -350,25 +352,20 @@ public class XStreamMarshallerTests {
private static void assertXpathExists(String xPathExpression, String inXMLString){
Source source = Input.fromString(inXMLString).build();
Iterable<Node> nodes = new JAXPXPathEngine().selectNodes(xPathExpression, source);
assertNotNull(nodes);
int count = 0;
for (Node node : nodes){
count++;
}
assertTrue("Expecting to find matches for Xpath " + xPathExpression, count > 0);
assertTrue("Expecting to find matches for Xpath " + xPathExpression, count(nodes) > 0);
}
private static void assertXpathNotExists(String xPathExpression, String inXMLString){
Source source = Input.fromString(inXMLString).build();
Iterable<Node> nodes = new JAXPXPathEngine().selectNodes(xPathExpression, source);
assertNotNull(nodes);
int count = 0;
assertEquals("Should be zero matches for Xpath " + xPathExpression, 0, count(nodes));
}
for (Node node : nodes){
count++;
}
assertEquals("Should be zero matches for Xpath " + xPathExpression, 0, count);
private static int count(Iterable<Node> nodes) {
assertNotNull(nodes);
AtomicInteger count = new AtomicInteger();
nodes.forEach(n -> count.incrementAndGet());
return count.get();
}
}

119
spring-tx/src/test/java/org/springframework/transaction/support/SimpleTransactionScopeTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -130,68 +130,69 @@ public class SimpleTransactionScopeTests { @@ -130,68 +130,69 @@ public class SimpleTransactionScopeTests {
@Test
public void getWithTransactionManager() throws Exception {
GenericApplicationContext context = new GenericApplicationContext();
context.getBeanFactory().registerScope("tx", new SimpleTransactionScope());
GenericBeanDefinition bd1 = new GenericBeanDefinition();
bd1.setBeanClass(TestBean.class);
bd1.setScope("tx");
bd1.setPrimary(true);
context.registerBeanDefinition("txScopedObject1", bd1);
GenericBeanDefinition bd2 = new GenericBeanDefinition();
bd2.setBeanClass(DerivedTestBean.class);
bd2.setScope("tx");
context.registerBeanDefinition("txScopedObject2", bd2);
context.refresh();
CallCountingTransactionManager tm = new CallCountingTransactionManager();
TransactionTemplate tt = new TransactionTemplate(tm);
Set<DerivedTestBean> finallyDestroy = new HashSet<>();
tt.execute(status -> {
TestBean bean1 = context.getBean(TestBean.class);
assertSame(bean1, context.getBean(TestBean.class));
try (GenericApplicationContext context = new GenericApplicationContext()) {
context.getBeanFactory().registerScope("tx", new SimpleTransactionScope());
GenericBeanDefinition bd1 = new GenericBeanDefinition();
bd1.setBeanClass(TestBean.class);
bd1.setScope("tx");
bd1.setPrimary(true);
context.registerBeanDefinition("txScopedObject1", bd1);
GenericBeanDefinition bd2 = new GenericBeanDefinition();
bd2.setBeanClass(DerivedTestBean.class);
bd2.setScope("tx");
context.registerBeanDefinition("txScopedObject2", bd2);
context.refresh();
CallCountingTransactionManager tm = new CallCountingTransactionManager();
TransactionTemplate tt = new TransactionTemplate(tm);
Set<DerivedTestBean> finallyDestroy = new HashSet<>();
tt.execute(status -> {
TestBean bean1 = context.getBean(TestBean.class);
assertSame(bean1, context.getBean(TestBean.class));
DerivedTestBean bean2 = context.getBean(DerivedTestBean.class);
assertSame(bean2, context.getBean(DerivedTestBean.class));
context.getBeanFactory().destroyScopedBean("txScopedObject2");
assertFalse(TransactionSynchronizationManager.hasResource("txScopedObject2"));
assertTrue(bean2.wasDestroyed());
DerivedTestBean bean2a = context.getBean(DerivedTestBean.class);
assertSame(bean2a, context.getBean(DerivedTestBean.class));
assertNotSame(bean2, bean2a);
context.getBeanFactory().getRegisteredScope("tx").remove("txScopedObject2");
assertFalse(TransactionSynchronizationManager.hasResource("txScopedObject2"));
assertFalse(bean2a.wasDestroyed());
DerivedTestBean bean2b = context.getBean(DerivedTestBean.class);
finallyDestroy.add(bean2b);
assertSame(bean2b, context.getBean(DerivedTestBean.class));
assertNotSame(bean2, bean2b);
assertNotSame(bean2a, bean2b);
Set<DerivedTestBean> immediatelyDestroy = new HashSet<>();
TransactionTemplate tt2 = new TransactionTemplate(tm);
tt2.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRED);
tt2.execute(status2 -> {
DerivedTestBean bean2c = context.getBean(DerivedTestBean.class);
immediatelyDestroy.add(bean2c);
assertSame(bean2c, context.getBean(DerivedTestBean.class));
assertNotSame(bean2, bean2c);
assertNotSame(bean2a, bean2c);
assertNotSame(bean2b, bean2c);
return null;
});
assertTrue(immediatelyDestroy.iterator().next().wasDestroyed());
assertFalse(bean2b.wasDestroyed());
DerivedTestBean bean2 = context.getBean(DerivedTestBean.class);
assertSame(bean2, context.getBean(DerivedTestBean.class));
context.getBeanFactory().destroyScopedBean("txScopedObject2");
assertFalse(TransactionSynchronizationManager.hasResource("txScopedObject2"));
assertTrue(bean2.wasDestroyed());
DerivedTestBean bean2a = context.getBean(DerivedTestBean.class);
assertSame(bean2a, context.getBean(DerivedTestBean.class));
assertNotSame(bean2, bean2a);
context.getBeanFactory().getRegisteredScope("tx").remove("txScopedObject2");
assertFalse(TransactionSynchronizationManager.hasResource("txScopedObject2"));
assertFalse(bean2a.wasDestroyed());
DerivedTestBean bean2b = context.getBean(DerivedTestBean.class);
finallyDestroy.add(bean2b);
assertSame(bean2b, context.getBean(DerivedTestBean.class));
assertNotSame(bean2, bean2b);
assertNotSame(bean2a, bean2b);
Set<DerivedTestBean> immediatelyDestroy = new HashSet<>();
TransactionTemplate tt2 = new TransactionTemplate(tm);
tt2.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRED);
tt2.execute(status2 -> {
DerivedTestBean bean2c = context.getBean(DerivedTestBean.class);
immediatelyDestroy.add(bean2c);
assertSame(bean2c, context.getBean(DerivedTestBean.class));
assertNotSame(bean2, bean2c);
assertNotSame(bean2a, bean2c);
assertNotSame(bean2b, bean2c);
return null;
});
assertTrue(immediatelyDestroy.iterator().next().wasDestroyed());
assertFalse(bean2b.wasDestroyed());
return null;
});
assertTrue(finallyDestroy.iterator().next().wasDestroyed());
assertTrue(finallyDestroy.iterator().next().wasDestroyed());
}
}
}

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/function/BodyExtractors.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
package org.springframework.web.reactive.function;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/resource/ContentVersionStrategy.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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,7 +20,6 @@ import java.io.IOException; @@ -20,7 +20,6 @@ import java.io.IOException;
import org.springframework.core.io.Resource;
import org.springframework.util.DigestUtils;
import org.springframework.util.FileCopyUtils;
/**
* A {@code VersionStrategy} that calculates an Hex MD5 hashes from the content

4
spring-web-reactive/src/main/java/org/springframework/web/reactive/resource/ResourceTransformerChain.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -16,8 +16,6 @@ @@ -16,8 +16,6 @@
package org.springframework.web.reactive.resource;
import java.io.IOException;
import reactor.core.publisher.Mono;
import org.springframework.core.io.Resource;

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -26,7 +26,6 @@ import org.springframework.beans.BeanUtils; @@ -26,7 +26,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.core.MethodParameter;
import org.springframework.core.ReactiveAdapter;
import org.springframework.core.ReactiveAdapterRegistry;
import org.springframework.core.ReactiveTypeDescriptor;
import org.springframework.core.ResolvableType;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.Assert;

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -21,7 +21,6 @@ import java.util.Optional; @@ -21,7 +21,6 @@ import java.util.Optional;
import org.springframework.core.MethodParameter;
import org.springframework.util.Assert;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestParam;

5
spring-web-reactive/src/main/java/org/springframework/web/reactive/socket/WebSocketHandler.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -15,9 +15,6 @@ @@ -15,9 +15,6 @@
*/
package org.springframework.web.reactive.socket;
import java.util.Collections;
import java.util.List;
import reactor.core.publisher.Mono;
/**

3
spring-web-reactive/src/test/java/org/springframework/web/reactive/config/ResourceHandlerRegistryTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -28,7 +28,6 @@ import reactor.test.StepVerifier; @@ -28,7 +28,6 @@ import reactor.test.StepVerifier;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.support.DataBufferTestUtils;
import org.springframework.http.CacheControl;
import org.springframework.http.HttpMethod;

3
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/HttpMessageWriterViewTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -29,7 +29,6 @@ import org.junit.Test; @@ -29,7 +29,6 @@ import org.junit.Test;
import reactor.test.StepVerifier;
import org.springframework.core.codec.CharSequenceEncoder;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.support.DataBufferTestUtils;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;

3
spring-web/src/main/java/org/springframework/http/client/reactive/ReactorClientHttpConnector.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -24,7 +24,6 @@ import reactor.core.publisher.Mono; @@ -24,7 +24,6 @@ import reactor.core.publisher.Mono;
import reactor.ipc.netty.http.client.HttpClientOptions;
import reactor.ipc.netty.options.ClientOptions;
import reactor.ipc.netty.http.client.HttpClient;
import reactor.ipc.netty.http.client.HttpClientException;
import org.springframework.http.HttpMethod;

3
spring-web/src/main/java/org/springframework/http/codec/ResourceRegionHttpMessageWriter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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,7 +34,6 @@ import org.springframework.core.io.support.ResourceRegion; @@ -34,7 +34,6 @@ import org.springframework.core.io.support.ResourceRegion;
import org.springframework.http.MediaType;
import org.springframework.http.ReactiveHttpOutputMessage;
import org.springframework.http.ZeroCopyHttpOutputMessage;
import org.springframework.util.ResourceUtils;
/**
* Implementation of {@link HttpMessageWriter} that can write

3
spring-web/src/main/java/org/springframework/http/codec/json/Jackson2JsonDecoder.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -23,7 +23,6 @@ import java.util.Map; @@ -23,7 +23,6 @@ import java.util.Map;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.type.TypeFactory;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

5
spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyHttpHandlerAdapter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -24,15 +24,12 @@ import io.netty.handler.codec.http.HttpResponseStatus; @@ -24,15 +24,12 @@ import io.netty.handler.codec.http.HttpResponseStatus;
import io.reactivex.netty.protocol.http.server.HttpServerRequest;
import io.reactivex.netty.protocol.http.server.HttpServerResponse;
import io.reactivex.netty.protocol.http.server.RequestHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Mono;
import rx.Observable;
import rx.RxReactiveStreams;
import org.springframework.core.io.buffer.NettyDataBufferFactory;
import org.springframework.util.Assert;
/**
* Adapt {@link HttpHandler} to the RxNetty {@link RequestHandler}.

3
spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyServerHttpRequest.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -19,7 +19,6 @@ package org.springframework.http.server.reactive; @@ -19,7 +19,6 @@ package org.springframework.http.server.reactive;
import java.net.InetSocketAddress;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.http.cookie.Cookie;

5
spring-web/src/main/java/org/springframework/web/bind/support/WebExchangeDataBinder.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
package org.springframework.web.bind.support;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -25,8 +24,6 @@ import java.util.TreeMap; @@ -25,8 +24,6 @@ import java.util.TreeMap;
import reactor.core.publisher.Mono;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.multipart.MultipartFile;

4
spring-web/src/main/java/org/springframework/web/context/request/async/TimeoutCallableProcessingInterceptor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -17,9 +17,7 @@ @@ -17,9 +17,7 @@
package org.springframework.web.context.request.async;
import java.util.concurrent.Callable;
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.HttpStatus;
import org.springframework.web.context.request.NativeWebRequest;
/**

4
spring-web/src/main/java/org/springframework/web/cors/reactive/DefaultCorsProcessor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -30,7 +30,6 @@ import org.springframework.http.server.reactive.ServerHttpResponse; @@ -30,7 +30,6 @@ import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.util.CollectionUtils;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.util.WebUtils;
/**
* The default implementation of {@link CorsProcessor},
@ -52,7 +51,6 @@ public class DefaultCorsProcessor implements CorsProcessor { @@ -52,7 +51,6 @@ public class DefaultCorsProcessor implements CorsProcessor {
@Override
@SuppressWarnings("resource")
public boolean processRequest(CorsConfiguration config, ServerWebExchange exchange) {
ServerHttpRequest request = exchange.getRequest();

4
spring-web/src/test/java/org/springframework/http/client/AbstractHttpRequestFactoryTestCase.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 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.
@ -136,7 +136,7 @@ public abstract class AbstractHttpRequestFactoryTestCase extends AbstractMockWeb @@ -136,7 +136,7 @@ public abstract class AbstractHttpRequestFactoryTestCase extends AbstractMockWeb
StreamUtils.copy(body, request.getBody());
}
ClientHttpResponse response = request.execute();
request.execute();
FileCopyUtils.copy(body, request.getBody());
}

13
spring-web/src/test/java/org/springframework/http/server/reactive/ListenerReadPublisherTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -16,10 +16,6 @@ @@ -16,10 +16,6 @@
package org.springframework.http.server.reactive;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.isA;
import static org.mockito.Mockito.mock;
import java.io.IOException;
import org.junit.Test;
@ -27,8 +23,12 @@ import org.mockito.invocation.InvocationOnMock; @@ -27,8 +23,12 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import org.springframework.core.io.buffer.DataBuffer;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.isA;
import static org.mockito.Mockito.mock;
import static org.junit.Assert.assertTrue;
/**
@ -40,8 +40,8 @@ import static org.junit.Assert.assertTrue; @@ -40,8 +40,8 @@ import static org.junit.Assert.assertTrue;
public class ListenerReadPublisherTests {
@Test
@SuppressWarnings("unchecked")
public void testReceiveTwoRequestCallsWhenOnSubscribe() {
@SuppressWarnings("unchecked")
Subscriber<DataBuffer> subscriber = mock(Subscriber.class);
doAnswer(new SubscriptionAnswer()).when(subscriber).onSubscribe(isA(Subscription.class));
@ -84,4 +84,5 @@ public class ListenerReadPublisherTests { @@ -84,4 +84,5 @@ public class ListenerReadPublisherTests {
}
}
}

12
spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -35,6 +35,8 @@ import org.junit.Before; @@ -35,6 +35,8 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.ClassPathResource;
@ -50,7 +52,6 @@ import org.springframework.http.client.ClientHttpRequestFactory; @@ -50,7 +52,6 @@ import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.client.Netty4ClientHttpRequestFactory;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.http.client.OkHttpClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.converter.json.MappingJacksonValue;
import org.springframework.util.LinkedMultiValueMap;
@ -67,17 +68,18 @@ public class RestTemplateIntegrationTests extends AbstractMockWebServerTestCase @@ -67,17 +68,18 @@ public class RestTemplateIntegrationTests extends AbstractMockWebServerTestCase
private RestTemplate template;
@Parameterized.Parameter
@Parameter
public ClientHttpRequestFactory clientHttpRequestFactory;
@Parameterized.Parameters
@Parameters
@SuppressWarnings("deprecation")
public static Iterable<? extends ClientHttpRequestFactory> data() {
return Arrays.asList(
new SimpleClientHttpRequestFactory(),
new HttpComponentsClientHttpRequestFactory(),
new Netty4ClientHttpRequestFactory(),
new OkHttp3ClientHttpRequestFactory(),
new OkHttpClientHttpRequestFactory()
new org.springframework.http.client.OkHttpClientHttpRequestFactory()
);
}

3
spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -74,7 +74,6 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver; @@ -74,7 +74,6 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
import org.springframework.web.servlet.HandlerAdapter;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.handler.AbstractHandlerMapping;

4
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ConsumesRequestCondition.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -28,8 +28,6 @@ import javax.servlet.http.HttpServletRequest; @@ -28,8 +28,6 @@ import javax.servlet.http.HttpServletRequest;
import org.springframework.http.InvalidMediaTypeException;
import org.springframework.http.MediaType;
import org.springframework.util.StringUtils;
import org.springframework.web.HttpMediaTypeException;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.cors.CorsUtils;
import org.springframework.web.servlet.mvc.condition.HeadersRequestCondition.HeaderExpression;

3
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -28,7 +28,6 @@ import java.util.concurrent.ConcurrentHashMap; @@ -28,7 +28,6 @@ import java.util.concurrent.ConcurrentHashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.xml.transform.Source;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;

3
spring-webmvc/src/main/java/org/springframework/web/servlet/support/WebContentGenerator.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -30,7 +30,6 @@ import javax.servlet.http.HttpServletResponse; @@ -30,7 +30,6 @@ import javax.servlet.http.HttpServletResponse;
import org.springframework.http.CacheControl;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.HttpRequestMethodNotSupportedException;

3
spring-webmvc/src/main/java/org/springframework/web/servlet/view/xslt/XsltView.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -44,7 +44,6 @@ import org.w3c.dom.Node; @@ -44,7 +44,6 @@ import org.w3c.dom.Node;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContextException;
import org.springframework.core.io.Resource;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;

4
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/StreamingResponseBodyReturnValueHandlerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -13,10 +13,10 @@ @@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.servlet.mvc.method.annotation;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.concurrent.CountDownLatch;

3
spring-webmvc/src/test/java/org/springframework/web/servlet/resource/AppCacheManifestTransformerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
package org.springframework.web.servlet.resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

14
spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/RssFeedViewTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -19,11 +19,11 @@ package org.springframework.web.servlet.view.feed; @@ -19,11 +19,11 @@ package org.springframework.web.servlet.view.feed;
import com.rometools.rome.feed.rss.Channel;
import com.rometools.rome.feed.rss.Description;
import com.rometools.rome.feed.rss.Item;
import org.junit.Before;
import org.junit.Test;
import org.springframework.mock.web.test.MockHttpServletRequest;
import org.springframework.mock.web.test.MockHttpServletResponse;
import org.xmlunit.matchers.CompareMatcher;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -41,12 +41,8 @@ import static org.xmlunit.matchers.CompareMatcher.isSimilarTo; @@ -41,12 +41,8 @@ import static org.xmlunit.matchers.CompareMatcher.isSimilarTo;
*/
public class RssFeedViewTests {
private AbstractRssFeedView view;
private final AbstractRssFeedView view = new MyRssFeedView();
@Before
public void createView() throws Exception {
view = new MyRssFeedView();
}
@Test
public void render() throws Exception {
@ -70,7 +66,7 @@ public class RssFeedViewTests { @@ -70,7 +66,7 @@ public class RssFeedViewTests {
private static class MyRssFeedView extends AbstractRssFeedView {
@Override
protected void buildFeedMetadata(Map model, Channel channel, HttpServletRequest request) {
protected void buildFeedMetadata(Map<String, Object> model, Channel channel, HttpServletRequest request) {
channel.setTitle("Test Feed");
channel.setDescription("Test feed description");
channel.setLink("http://example.com");

3
spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -646,7 +646,6 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser { @@ -646,7 +646,6 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
private final List<WebSocketHandlerDecoratorFactory> factories;
@SuppressWarnings("unused")
private DecoratingFactoryBean(WebSocketHandler handler, List<WebSocketHandlerDecoratorFactory> factories) {
this.handler = handler;
this.factories = factories;

3
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/EventSourceTransportHandler.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -27,7 +27,6 @@ import org.springframework.web.socket.sockjs.frame.SockJsFrameFormat; @@ -27,7 +27,6 @@ import org.springframework.web.socket.sockjs.frame.SockJsFrameFormat;
import org.springframework.web.socket.sockjs.transport.SockJsServiceConfig;
import org.springframework.web.socket.sockjs.transport.SockJsSession;
import org.springframework.web.socket.sockjs.transport.TransportType;
import org.springframework.web.socket.sockjs.transport.session.PollingSockJsSession;
import org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession;
/**

3
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/HtmlFileTransportHandler.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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,7 +36,6 @@ import org.springframework.web.socket.sockjs.transport.SockJsSession; @@ -36,7 +36,6 @@ import org.springframework.web.socket.sockjs.transport.SockJsSession;
import org.springframework.web.socket.sockjs.transport.TransportHandler;
import org.springframework.web.socket.sockjs.transport.TransportType;
import org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession;
import org.springframework.web.socket.sockjs.transport.session.PollingSockJsSession;
import org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession;
import org.springframework.web.util.JavaScriptUtils;

3
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/XhrPollingTransportHandler.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -27,7 +27,6 @@ import org.springframework.web.socket.sockjs.frame.SockJsFrameFormat; @@ -27,7 +27,6 @@ import org.springframework.web.socket.sockjs.frame.SockJsFrameFormat;
import org.springframework.web.socket.sockjs.transport.SockJsSession;
import org.springframework.web.socket.sockjs.transport.TransportHandler;
import org.springframework.web.socket.sockjs.transport.TransportType;
import org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession;
import org.springframework.web.socket.sockjs.transport.session.PollingSockJsSession;
/**

3
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/XhrStreamingTransportHandler.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -28,7 +28,6 @@ import org.springframework.web.socket.sockjs.transport.SockJsServiceConfig; @@ -28,7 +28,6 @@ import org.springframework.web.socket.sockjs.transport.SockJsServiceConfig;
import org.springframework.web.socket.sockjs.transport.SockJsSession;
import org.springframework.web.socket.sockjs.transport.TransportHandler;
import org.springframework.web.socket.sockjs.transport.TransportType;
import org.springframework.web.socket.sockjs.transport.session.PollingSockJsSession;
import org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession;
/**

4
spring-websocket/src/test/java/org/springframework/web/socket/messaging/StompSubProtocolHandlerTests.java

@ -545,9 +545,9 @@ public class StompSubProtocolHandlerTests { @@ -545,9 +545,9 @@ public class StompSubProtocolHandlerTests {
private static class TestMessageHandler implements MessageHandler {
private final List<Message> messages = new ArrayList<>();
private final List<Message<?>> messages = new ArrayList<>();
public List<Message> getMessages() {
public List<Message<?>> getMessages() {
return this.messages;
}

1
spring-websocket/src/test/java/org/springframework/web/socket/messaging/WebSocketStompClientTests.java

@ -100,7 +100,6 @@ public class WebSocketStompClientTests { @@ -100,7 +100,6 @@ public class WebSocketStompClientTests {
}
@Test
@SuppressWarnings("unchecked")
public void webSocketConnectionEstablished() throws Exception {
connect().afterConnectionEstablished(this.webSocketSession);
verify(this.stompSession).afterConnected(notNull());

1
spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java

@ -147,7 +147,6 @@ public class SockJsServiceTests extends AbstractHttpRequestTests { @@ -147,7 +147,6 @@ public class SockJsServiceTests extends AbstractHttpRequestTests {
}
@Test // SPR-11919
@SuppressWarnings("unchecked")
public void handleInfoGetWildflyNPE() throws Exception {
HttpServletResponse mockResponse = mock(HttpServletResponse.class);
ServletOutputStream ous = mock(ServletOutputStream.class);

Loading…
Cancel
Save