diff --git a/pom.xml b/pom.xml index 58d3f26101..9b0d064015 100644 --- a/pom.xml +++ b/pom.xml @@ -159,6 +159,9 @@ 1.5 1.5 + -Xlint:all + true + false diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractAggregatingMessageGroupProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractAggregatingMessageGroupProcessor.java index aff3971a6d..f51d3599a3 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractAggregatingMessageGroupProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractAggregatingMessageGroupProcessor.java @@ -13,6 +13,11 @@ package org.springframework.integration.aggregator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.integration.channel.MessageChannelTemplate; @@ -23,8 +28,6 @@ import org.springframework.integration.message.MessageBuilder; import org.springframework.integration.store.MessageGroup; import org.springframework.util.Assert; -import java.util.*; - /** * Base class for MessageGroupProcessor implementations that aggregate the group of Messages into a single Message. * diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aop/PublisherAnnotationBeanPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/aop/PublisherAnnotationBeanPostProcessor.java index 8f0a18482e..08979418c4 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aop/PublisherAnnotationBeanPostProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aop/PublisherAnnotationBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -37,6 +37,7 @@ import org.springframework.util.ClassUtils; * @author Mark Fisher * @since 2.0 */ +@SuppressWarnings("serial") public class PublisherAnnotationBeanPostProcessor extends ProxyConfig implements BeanPostProcessor, BeanClassLoaderAware, BeanFactoryAware, InitializingBean, Ordered { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/BeanFactoryChannelResolver.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/BeanFactoryChannelResolver.java index 056adf9b69..5e7e55c9a2 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/BeanFactoryChannelResolver.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/BeanFactoryChannelResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -69,7 +69,7 @@ public class BeanFactoryChannelResolver implements ChannelResolver, BeanFactoryA public MessageChannel resolveChannelName(String name) { Assert.state(this.beanFactory != null, "BeanFactory is required"); try { - return (MessageChannel) this.beanFactory.getBean(name, MessageChannel.class); + return this.beanFactory.getBean(name, MessageChannel.class); } catch (BeansException e) { throw new ChannelResolutionException( diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelResolutionException.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelResolutionException.java index 5ae5293d0d..28026f3dd8 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelResolutionException.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelResolutionException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,6 +24,7 @@ import org.springframework.integration.core.MessagingException; * @author Mark Fisher * @see ChannelResolver */ +@SuppressWarnings("serial") public class ChannelResolutionException extends MessagingException { /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/MessageChannelTemplate.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/MessageChannelTemplate.java index d8237f2bf8..2962890620 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/MessageChannelTemplate.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/MessageChannelTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -269,7 +269,7 @@ public class MessageChannelTemplate implements InitializingBean { } - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "unused"}) private static class TemporaryReplyChannel implements PollableChannel { private volatile Message message; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/ConsumerEndpointFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/config/ConsumerEndpointFactoryBean.java index cd7259f4b4..48db714d3d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/ConsumerEndpointFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/ConsumerEndpointFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -38,7 +38,7 @@ import org.springframework.util.Assert; * @author Mark Fisher */ public class ConsumerEndpointFactoryBean - implements FactoryBean, BeanFactoryAware, BeanNameAware, InitializingBean, SmartLifecycle { + implements FactoryBean, BeanFactoryAware, BeanNameAware, InitializingBean, SmartLifecycle { private volatile MessageHandler handler; @@ -100,7 +100,7 @@ public class ConsumerEndpointFactoryBean return true; } - public Object getObject() throws Exception { + public AbstractEndpoint getObject() throws Exception { if (!this.initialized) { this.initializeEndpoint(); } @@ -122,8 +122,7 @@ public class ConsumerEndpointFactoryBean Assert.hasText(this.inputChannelName, "inputChannelName is required"); Assert.isTrue(this.beanFactory.containsBean(this.inputChannelName), "no such input channel '" + this.inputChannelName + "' for endpoint '" + this.beanName + "'"); - MessageChannel channel = (MessageChannel) - this.beanFactory.getBean(this.inputChannelName, MessageChannel.class); + MessageChannel channel = this.beanFactory.getBean(this.inputChannelName, MessageChannel.class); if (channel instanceof SubscribableChannel) { Assert.isNull(this.pollerMetadata, "A poller should not be specified for endpoint '" + this.beanName + "', since '" + this.inputChannelName + "' is a SubscribableChannel (not pollable)."); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java index 33d2020153..9d7ccb6e04 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,8 +36,8 @@ import org.springframework.util.Assert; * * @author Mark Fisher */ -public class SourcePollingChannelAdapterFactoryBean implements FactoryBean, BeanFactoryAware, BeanNameAware, - BeanClassLoaderAware, InitializingBean, SmartLifecycle { +public class SourcePollingChannelAdapterFactoryBean implements FactoryBean, + BeanFactoryAware, BeanNameAware, BeanClassLoaderAware, InitializingBean, SmartLifecycle { private volatile MessageSource source; @@ -94,7 +94,7 @@ public class SourcePollingChannelAdapterFactoryBean implements FactoryBean, Bean this.initializeAdapter(); } - public Object getObject() throws Exception { + public SourcePollingChannelAdapter getObject() throws Exception { if (this.adapter == null) { this.initializeAdapter(); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessor.java index cd4be0f222..c980daee4d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessor.java @@ -63,7 +63,7 @@ import org.springframework.util.StringUtils; * @author Mark Fisher * @author Marius Bogoevici */ -public class MessagingAnnotationPostProcessor implements BeanPostProcessor, BeanFactoryAware, InitializingBean, Lifecycle, ApplicationListener { +public class MessagingAnnotationPostProcessor implements BeanPostProcessor, BeanFactoryAware, InitializingBean, Lifecycle, ApplicationListener { private final Log logger = LogFactory.getLog(this.getClass()); @@ -73,7 +73,7 @@ public class MessagingAnnotationPostProcessor implements BeanPostProcessor, Bean private final Map, MethodAnnotationPostProcessor> postProcessors = new HashMap, MethodAnnotationPostProcessor>(); - private final Set listeners = new HashSet(); + private final Set> listeners = new HashSet>(); private final Set lifecycles = new HashSet(); @@ -186,7 +186,7 @@ public class MessagingAnnotationPostProcessor implements BeanPostProcessor, Bean } public void onApplicationEvent(ApplicationEvent event) { - for (ApplicationListener listener : listeners) { + for (ApplicationListener listener : listeners) { try { listener.onApplicationEvent(event); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractDelegatingConsumerEndpointParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractDelegatingConsumerEndpointParser.java index aba9913b70..6337684275 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractDelegatingConsumerEndpointParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractDelegatingConsumerEndpointParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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 @@ package org.springframework.integration.config.xml; -import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.parsing.BeanComponentDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/core/MessageHeaders.java b/spring-integration-core/src/main/java/org/springframework/integration/core/MessageHeaders.java index 7d6ef01e27..26762a3acb 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/core/MessageHeaders.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/core/MessageHeaders.java @@ -42,6 +42,8 @@ import org.springframework.integration.history.MessageHistory; */ public final class MessageHeaders implements Map, Serializable { + private static final long serialVersionUID = -6515612906857332100L; + private static final Log logger = LogFactory.getLog(MessageHeaders.class); public static final String PREFIX = "$"; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java index bfda1621fd..9409d098ba 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java @@ -30,7 +30,6 @@ import org.springframework.beans.SimpleTypeConverter; import org.springframework.beans.TypeConverter; import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.beans.factory.FactoryBean; -import org.springframework.context.Lifecycle; import org.springframework.integration.annotation.Gateway; import org.springframework.integration.core.Message; import org.springframework.integration.core.MessageChannel; @@ -315,18 +314,14 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint implements Factory @Override // guarded by super#lifecycleLock protected void doStart() { for (SimpleMessagingGateway gateway : this.gatewayMap.values()) { - if (gateway instanceof Lifecycle) { - ((Lifecycle) gateway).start(); - } + gateway.start(); } } @Override // guarded by super#lifecycleLock protected void doStop() { for (SimpleMessagingGateway gateway : this.gatewayMap.values()) { - if (gateway instanceof Lifecycle) { - ((Lifecycle) gateway).stop(); - } + gateway.stop(); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/SimpleMessageMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/SimpleMessageMapper.java index 81350fb161..9a8e1571ab 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/SimpleMessageMapper.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/SimpleMessageMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -49,7 +49,7 @@ public class SimpleMessageMapper implements InboundMessageMapper, Outbou if (object == null) { return null; } - if (object instanceof Message) { + if (object instanceof Message) { return (Message) object; } return MessageBuilder.withPayload(object).build(); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/ArgumentArrayMessageMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/ArgumentArrayMessageMapper.java index 328cf06d58..7b9310faed 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/ArgumentArrayMessageMapper.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/ArgumentArrayMessageMapper.java @@ -131,7 +131,7 @@ public class ArgumentArrayMessageMapper implements InboundMessageMapper headers = new HashMap(); for (int i = 0; i < this.parameterList.size(); i++) { Object argumentValue = arguments[i]; - MethodParameter methodParameter = (MethodParameter) this.parameterList.get(i); + MethodParameter methodParameter = this.parameterList.get(i); Annotation annotation = this.findMappingAnnotation(methodParameter.getParameterAnnotations()); if (annotation != null) { if (annotation.annotationType().equals(Payload.class)) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistoryEvent.java b/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistoryEvent.java index 9f94827c3e..81cfbf6e60 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistoryEvent.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/history/MessageHistoryEvent.java @@ -27,6 +27,8 @@ import java.io.Serializable; */ public class MessageHistoryEvent implements Serializable { + private static final long serialVersionUID = 1623653800353662107L; + private final String name; private final String type; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/message/ErrorMessage.java b/spring-integration-core/src/main/java/org/springframework/integration/message/ErrorMessage.java index f241a19295..efd73833b3 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/message/ErrorMessage.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/message/ErrorMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,6 +23,8 @@ package org.springframework.integration.message; */ public class ErrorMessage extends GenericMessage { + private static final long serialVersionUID = 6413675958959141186L; + public ErrorMessage(Throwable payload) { super(payload); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/message/GenericMessage.java b/spring-integration-core/src/main/java/org/springframework/integration/message/GenericMessage.java index d2e3a50c24..33ff11b412 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/message/GenericMessage.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/message/GenericMessage.java @@ -32,6 +32,8 @@ import org.springframework.util.ObjectUtils; */ public class GenericMessage implements Message, Serializable { + private static final long serialVersionUID = 3649200745084232821L; + private final T payload; private final MessageHeaders headers; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/message/MessageTimeoutException.java b/spring-integration-core/src/main/java/org/springframework/integration/message/MessageTimeoutException.java index d568f2d3bc..baddb57970 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/message/MessageTimeoutException.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/message/MessageTimeoutException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,6 +21,7 @@ import org.springframework.integration.core.Message; /** * @author Mark Fisher */ +@SuppressWarnings("serial") public class MessageTimeoutException extends MessageHandlingException { public MessageTimeoutException(Message failedMessage, String description, Throwable cause) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/message/StringMessage.java b/spring-integration-core/src/main/java/org/springframework/integration/message/StringMessage.java index 88b3fc9295..c7155819f4 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/message/StringMessage.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/message/StringMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,6 +23,8 @@ package org.springframework.integration.message; */ public class StringMessage extends GenericMessage { + private static final long serialVersionUID = -5084164633133229804L; + public StringMessage(String payload) { super(payload); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/MapToObjectTransformer.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/MapToObjectTransformer.java index 0f251a68eb..76fe5bd649 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/MapToObjectTransformer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/MapToObjectTransformer.java @@ -73,14 +73,13 @@ public class MapToObjectTransformer extends AbstractPayloadTransformer, * (non-Javadoc) * @see org.springframework.integration.transformer.AbstractPayloadTransformer#transformPayload(java.lang.Object) */ - @SuppressWarnings("unchecked") protected Object transformPayload(Map payload) throws Exception { Object target = (this.targetClass != null) ? BeanUtils.instantiate(this.targetClass) : this.beanFactory.getBean(this.targetBeanName); DataBinder binder = new DataBinder(target); binder.setConversionService(this.beanFactory.getConversionService()); - binder.bind(new MutablePropertyValues((Map) payload)); + binder.bind(new MutablePropertyValues(payload)); return target; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/MessageTransformationException.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/MessageTransformationException.java index 211296553a..d94e3969a8 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/MessageTransformationException.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/MessageTransformationException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,6 +24,7 @@ import org.springframework.integration.core.MessagingException; * * @author Mark Fisher */ +@SuppressWarnings("serial") public class MessageTransformationException extends MessagingException { public MessageTransformationException(Message message, String description, Throwable cause) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToSpelMapBuilder.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToSpelMapBuilder.java index eef9becb4a..3800959ee6 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToSpelMapBuilder.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/ObjectToSpelMapBuilder.java @@ -111,7 +111,7 @@ class ObjectToSpelMapBuilder { int i = 0; for (Object arrayElement : arrayElements) { String arrayPropertyPath = propertyPath + "[" + i++ + "]"; - if (arrayElement instanceof Map) { + if (arrayElement instanceof Map) { // last argument is empty because it is not a named property, but an array element this.processMap(context, propertiesMap, (Map) arrayElement, arrayPropertyPath, ""); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/scenarios/AggregationResendTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/scenarios/AggregationResendTests.java index 32282db258..5d7541b57b 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/scenarios/AggregationResendTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/scenarios/AggregationResendTests.java @@ -92,7 +92,6 @@ public class AggregationResendTests { do { replyMessage = reply.receive(waitSeconds); if (null != replyMessage) { - System.out.println("Message Received: " + replyMessage); messageCount++; } } while (null != replyMessage); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java index c150efbf37..105b10544e 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -164,9 +164,10 @@ public class ChannelInterceptorTests { DirectFieldAccessor cAccessor = new DirectFieldAccessor(channel); Object iList = cAccessor.getPropertyValue("interceptors"); DirectFieldAccessor iAccessor = new DirectFieldAccessor(iList); - List interceptoList = + @SuppressWarnings("unchecked") + List interceptorList = (List) iAccessor.getPropertyValue("interceptors"); - String foo = interceptoList.get(0).getFoo(); + String foo = interceptorList.get(0).getFoo(); assertTrue(StringUtils.hasText(foo)); assertEquals("foo", foo); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorTests.java index ccca40367b..0185b176e6 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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.Map; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.DirectFieldAccessor; -import org.springframework.beans.factory.BeanCreationException; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.core.Ordered; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBeanTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBeanTests.java index 522db86d18..3888eab6a6 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBeanTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/SourcePollingChannelAdapterFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,12 +26,9 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.aopalliance.aop.Advice; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; - import org.junit.Test; - import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.core.Message; -import org.springframework.integration.endpoint.AbstractEndpoint; import org.springframework.integration.message.MessageSource; import org.springframework.integration.message.StringMessage; import org.springframework.integration.scheduling.PollerMetadata; @@ -69,7 +66,7 @@ public class SourcePollingChannelAdapterFactoryBeanTests { factoryBean.setPollerMetadata(pollerMetadata); factoryBean.setAutoStartup(true); factoryBean.afterPropertiesSet(); - context.registerEndpoint("testPollingEndpoint", (AbstractEndpoint) factoryBean.getObject()); + context.registerEndpoint("testPollingEndpoint", factoryBean.getObject()); context.refresh(); Message message = outputChannel.receive(30000); assertEquals("test", message.getPayload()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/WireTapParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/WireTapParserTests.java index 49855690e0..31caf503e6 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/WireTapParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/WireTapParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -79,11 +79,10 @@ public class WireTapParserTests { } @Test - @SuppressWarnings("unchecked") public void wireTapTimeouts() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "wireTapParserTests.xml", this.getClass()); - Map beans = (Map) context.getBeansOfType(WireTap.class); + Map beans = context.getBeansOfType(WireTap.class); int defaultTimeoutCount = 0; int expectedTimeoutCount = 0; int otherTimeoutCount = 0; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessorTests.java index ad2f349554..92c2735491 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -313,6 +313,7 @@ public class MessagingAnnotationPostProcessorTests { } @ServiceActivator(inputChannel="testChannel") + @SuppressWarnings("unused") public void countdown(String input) { this.messageText = input; latch.countDown(); @@ -342,6 +343,7 @@ public class MessagingAnnotationPostProcessorTests { @MessageEndpoint private static class ServiceActivatorAnnotatedBean { + @SuppressWarnings("unused") @ServiceActivator(inputChannel="inputChannel") public String test(String s) { return s + s; @@ -353,6 +355,7 @@ public class MessagingAnnotationPostProcessorTests { @MessageEndpoint private static class TransformerAnnotationTestBean { + @SuppressWarnings("unused") @Transformer(inputChannel="inputChannel", outputChannel="outputChannel") public String transformBefore(String input) { return input.toUpperCase(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests.java index 0fc58840ff..f845aec2d7 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/DelayerUsageTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -22,7 +22,6 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.integration.channel.PollableChannel; -import org.springframework.integration.core.Message; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.message.MessageBuilder; import org.springframework.integration.message.StringMessage; @@ -46,24 +45,22 @@ public class DelayerUsageTests { private MessageChannel inputB; @Autowired @Qualifier("outputB1") private PollableChannel outputB1; - @Autowired - private SampleService sampleHandler; @Test public void testDelayWithDefaultScheduler(){ long start = System.currentTimeMillis(); inputA.send(new StringMessage("Hello")); - Message msg = (Message) outputA.receive(); + outputA.receive(); assertTrue((System.currentTimeMillis() - start) >= 1000); } @Test public void testDelayWithDefaultSchedulerCustomDelayHeader(){ - MessageBuilder builder = MessageBuilder.withPayload("Hello"); + MessageBuilder builder = MessageBuilder.withPayload("Hello"); // set custom delay header builder.setHeader("foo", 2000); long start = System.currentTimeMillis(); inputA.send(builder.build()); - Message msg = (Message) outputA.receive(); + outputA.receive(); assertTrue((System.currentTimeMillis() - start) >= 2000); } @Test @@ -76,13 +73,13 @@ public class DelayerUsageTests { inputB.send(new StringMessage("5")); inputB.send(new StringMessage("6")); inputB.send(new StringMessage("7")); - Message msg = (Message) outputB1.receive(); - msg = (Message) outputB1.receive(); - msg = (Message) outputB1.receive(); - msg = (Message) outputB1.receive(); - msg = (Message) outputB1.receive(); - msg = (Message) outputB1.receive(); - msg = (Message) outputB1.receive(); + outputB1.receive(); + outputB1.receive(); + outputB1.receive(); + outputB1.receive(); + outputB1.receive(); + outputB1.receive(); + outputB1.receive(); // must execute under 3 seconds, since threadPool is set too 5. // first batch is 5 concurrent invocations on SA, then 2 more diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/CorrelationIdTests.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/CorrelationIdTests.java index 0f1cafa65b..13565381f4 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/CorrelationIdTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/CorrelationIdTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -127,6 +127,7 @@ public class CorrelationIdTests { assertEquals(correlationIdForTest, reply2.getHeaders().getCorrelationId()); } + @SuppressWarnings("unused") private static class TestBean { public String upperCase(String input) { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ServiceActivatorMethodResolutionTests.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ServiceActivatorMethodResolutionTests.java index 5c42c2da83..c923014582 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ServiceActivatorMethodResolutionTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ServiceActivatorMethodResolutionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -66,6 +66,7 @@ public class ServiceActivatorMethodResolutionTests { } + @SuppressWarnings("unused") private static class SingleAnnotationTestBean { @ServiceActivator @@ -79,6 +80,7 @@ public class ServiceActivatorMethodResolutionTests { } + @SuppressWarnings("unused") private static class MultipleAnnotationTestBean { @ServiceActivator @@ -93,6 +95,7 @@ public class ServiceActivatorMethodResolutionTests { } + @SuppressWarnings("unused") private static class SinglePublicMethodTestBean { public String upperCase(String s) { @@ -105,6 +108,7 @@ public class ServiceActivatorMethodResolutionTests { } + @SuppressWarnings("unused") private static class MultiplePublicMethodTestBean { public String upperCase(String s) { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/filter/MethodInvokingSelectorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/filter/MethodInvokingSelectorTests.java index a2367484cc..5026679721 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/filter/MethodInvokingSelectorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/filter/MethodInvokingSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -89,6 +89,7 @@ public class MethodInvokingSelectorTests { } + @SuppressWarnings("unused") private static class TestBean { public boolean acceptString(Message message) { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/ArgumentArrayMessageMapperToMessageTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/ArgumentArrayMessageMapperToMessageTests.java index ba70f14226..288e915d24 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/ArgumentArrayMessageMapperToMessageTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/ArgumentArrayMessageMapperToMessageTests.java @@ -208,7 +208,7 @@ public class ArgumentArrayMessageMapperToMessageTests { public void toMessageWithPayloadAndIllegalHeader() throws Exception { Method method = TestService.class.getMethod("sendPayloadAndIllegalHeader", String.class, String.class); ArgumentArrayMessageMapper mapper = new ArgumentArrayMessageMapper(method); - Message message = mapper.toMessage(new Object[] { "test", "foo"}); + mapper.toMessage(new Object[] { "test", "foo"}); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/ExpressionEvaluatingMessageProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/ExpressionEvaluatingMessageProcessorTests.java index 33e0105c66..26e6d0fd1c 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/ExpressionEvaluatingMessageProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/ExpressionEvaluatingMessageProcessorTests.java @@ -1,129 +1,130 @@ -/* - * Copyright 2002-2010 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. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.springframework.integration.handler; - -import static org.junit.Assert.assertEquals; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.hamcrest.Description; -import org.junit.Rule; -import org.junit.Test; -import org.junit.internal.matchers.TypeSafeMatcher; -import org.junit.rules.ExpectedException; -import org.springframework.expression.EvaluationException; -import org.springframework.integration.message.GenericMessage; -import org.springframework.integration.message.StringMessage; - -/** - * @author Dave Syer - * @since 2.0 - * - */ -public class ExpressionEvaluatingMessageProcessorTests { - - private static final Log logger = LogFactory.getLog(ExpressionEvaluatingMessageProcessorTests.class); - - @Rule - public ExpectedException expected = ExpectedException.none(); - - @Test - public void testProcessMessage() { - ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload"); - assertEquals("foo", processor.processMessage(new StringMessage("foo"))); - } - - @Test - public void testProcessMessageWithDollar() { - ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("headers['$id']"); - StringMessage message = new StringMessage("foo"); - assertEquals(message.getHeaders().getId(), processor.processMessage(message)); - } - - @Test - public void testProcessMessageWithStaticKey() { - ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("headers[headers.ID]"); - StringMessage message = new StringMessage("foo"); - assertEquals(message.getHeaders().getId(), processor.processMessage(message)); - } - - @Test - public void testProcessMessageBadExpression() { - expected.expect(new TypeSafeMatcher(Exception.class) { - private Throwable cause; - @Override - public boolean matchesSafely(Exception item) { - logger.debug(item); - cause = item.getCause(); - return cause instanceof EvaluationException; - } - public void describeTo(Description description) { - description.appendText("cause to be EvaluationException but was ").appendValue(cause); - } - }); - ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.fixMe()"); - assertEquals("foo", processor.processMessage(new StringMessage("foo"))); - } - - @Test - public void testProcessMessageExpressionThrowsRuntimeException() { - expected.expect(new TypeSafeMatcher(Exception.class) { - private Throwable cause; - @Override - public boolean matchesSafely(Exception item) { - logger.debug(item); - cause = item.getCause(); - return cause instanceof UnsupportedOperationException; - } - public void describeTo(Description description) { - description.appendText("cause to be UnsupportedOperationException but was ").appendValue(cause); - } - }); - ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.error()"); - assertEquals("foo", processor.processMessage(new GenericMessage(this))); - } - - @Test - public void testProcessMessageExpressionThrowsCheckedException() { - expected.expect(new TypeSafeMatcher(Exception.class) { - private Throwable cause; - @Override - public boolean matchesSafely(Exception item) { - logger.debug(item); - cause = item.getCause(); - return cause instanceof CheckedException; - } - public void describeTo(Description description) { - description.appendText("cause to be CheckedException but was ").appendValue(cause); - } - }); - ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.check()"); - assertEquals("foo", processor.processMessage(new GenericMessage(this))); - } - - public String error() { - throw new UnsupportedOperationException("Expected test exception"); - } - - public String check() throws Exception { - throw new CheckedException("Expected test exception"); - } - - private static final class CheckedException extends Exception { - public CheckedException(String string) { - super(string); - } - } - -} +/* + * Copyright 2002-2010 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. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.springframework.integration.handler; + +import static org.junit.Assert.assertEquals; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.hamcrest.Description; +import org.junit.Rule; +import org.junit.Test; +import org.junit.internal.matchers.TypeSafeMatcher; +import org.junit.rules.ExpectedException; +import org.springframework.expression.EvaluationException; +import org.springframework.integration.message.GenericMessage; +import org.springframework.integration.message.StringMessage; + +/** + * @author Dave Syer + * @since 2.0 + * + */ +public class ExpressionEvaluatingMessageProcessorTests { + + private static final Log logger = LogFactory.getLog(ExpressionEvaluatingMessageProcessorTests.class); + + @Rule + public ExpectedException expected = ExpectedException.none(); + + @Test + public void testProcessMessage() { + ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload"); + assertEquals("foo", processor.processMessage(new StringMessage("foo"))); + } + + @Test + public void testProcessMessageWithDollar() { + ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("headers['$id']"); + StringMessage message = new StringMessage("foo"); + assertEquals(message.getHeaders().getId(), processor.processMessage(message)); + } + + @Test + public void testProcessMessageWithStaticKey() { + ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("headers[headers.ID]"); + StringMessage message = new StringMessage("foo"); + assertEquals(message.getHeaders().getId(), processor.processMessage(message)); + } + + @Test + public void testProcessMessageBadExpression() { + expected.expect(new TypeSafeMatcher(Exception.class) { + private Throwable cause; + @Override + public boolean matchesSafely(Exception item) { + logger.debug(item); + cause = item.getCause(); + return cause instanceof EvaluationException; + } + public void describeTo(Description description) { + description.appendText("cause to be EvaluationException but was ").appendValue(cause); + } + }); + ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.fixMe()"); + assertEquals("foo", processor.processMessage(new StringMessage("foo"))); + } + + @Test + public void testProcessMessageExpressionThrowsRuntimeException() { + expected.expect(new TypeSafeMatcher(Exception.class) { + private Throwable cause; + @Override + public boolean matchesSafely(Exception item) { + logger.debug(item); + cause = item.getCause(); + return cause instanceof UnsupportedOperationException; + } + public void describeTo(Description description) { + description.appendText("cause to be UnsupportedOperationException but was ").appendValue(cause); + } + }); + ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.error()"); + assertEquals("foo", processor.processMessage(new GenericMessage(this))); + } + + @Test + public void testProcessMessageExpressionThrowsCheckedException() { + expected.expect(new TypeSafeMatcher(Exception.class) { + private Throwable cause; + @Override + public boolean matchesSafely(Exception item) { + logger.debug(item); + cause = item.getCause(); + return cause instanceof CheckedException; + } + public void describeTo(Description description) { + description.appendText("cause to be CheckedException but was ").appendValue(cause); + } + }); + ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("payload.check()"); + assertEquals("foo", processor.processMessage(new GenericMessage(this))); + } + + public String error() { + throw new UnsupportedOperationException("Expected test exception"); + } + + public String check() throws Exception { + throw new CheckedException("Expected test exception"); + } + + @SuppressWarnings("serial") + private static final class CheckedException extends Exception { + public CheckedException(String string) { + super(string); + } + } + +} diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/MethodInvokingMessageProcessorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/MethodInvokingMessageProcessorTests.java index 82fe5986bd..58efc4cb39 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/MethodInvokingMessageProcessorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/MethodInvokingMessageProcessorTests.java @@ -357,6 +357,7 @@ public class MethodInvokingMessageProcessorTests { } } + @SuppressWarnings("serial") public static final class CheckedException extends Exception { public CheckedException(String string) { super(string); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/json/InboundJsonMessageMapperTests.java b/spring-integration-core/src/test/java/org/springframework/integration/json/InboundJsonMessageMapperTests.java index 466fa01187..025e3e4d40 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/json/InboundJsonMessageMapperTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/json/InboundJsonMessageMapperTests.java @@ -60,7 +60,7 @@ public class InboundJsonMessageMapperTests { String jsonMessage = "{\"headers\":{\"$timestamp\":1,\"$id\":\"" + id + "\"},\"payload\":\"myPayloadStuff\"}"; Message expected = MessageBuilder.withPayload("myPayloadStuff").setHeader(MessageHeaders.TIMESTAMP, new Long(1)).setHeader(MessageHeaders.ID, id).build(); InboundJsonMessageMapper mapper = new InboundJsonMessageMapper(String.class); - Message result = (Message) mapper.toMessage(jsonMessage); + Message result = mapper.toMessage(jsonMessage); assertThat(result, sameExceptImmutableHeaders(expected)); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/message/MethodInvokingSourceTests.java b/spring-integration-core/src/test/java/org/springframework/integration/message/MethodInvokingSourceTests.java index 31a43d4e19..7be1fb2f8f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/message/MethodInvokingSourceTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/message/MethodInvokingSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -66,6 +66,7 @@ public class MethodInvokingSourceTests { } + @SuppressWarnings("unused") private static class TestBean { public String validMethod() { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/splitter/SpelSplitterIntegrationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/splitter/SpelSplitterIntegrationTests.java index b23d136860..07d38f4872 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/splitter/SpelSplitterIntegrationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/splitter/SpelSplitterIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -52,10 +52,10 @@ public class SpelSplitterIntegrationTests { public void split() { Message message = MessageBuilder.withPayload(new TestBean()).setHeader("foo", "foo").build(); this.input.send(message); - Message one = output.receive(0); - Message two = output.receive(0); - Message three = output.receive(0); - Message four = output.receive(0); + Message one = output.receive(0); + Message two = output.receive(0); + Message three = output.receive(0); + Message four = output.receive(0); assertEquals(new Integer(1), one.getPayload()); assertEquals("foo", one.getHeaders().get("foo")); assertEquals(new Integer(2), two.getPayload()); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/transformer/MapToObjectTransformerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/transformer/MapToObjectTransformerTests.java index 363d39bc81..fc711b98d4 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/transformer/MapToObjectTransformerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/transformer/MapToObjectTransformerTests.java @@ -19,7 +19,6 @@ package org.springframework.integration.transformer; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNull; -import static junit.framework.Assert.assertTrue; import java.util.HashMap; import java.util.Map; @@ -63,7 +62,6 @@ public class MapToObjectTransformerTests { assertEquals("Case", person.getLname()); assertNull(person.getSsn()); assertNotNull(person.getAddress()); - assertTrue(person.getAddress() instanceof Address); assertEquals("1123 Main st", person.getAddress().getStreet()); } @@ -108,7 +106,6 @@ public class MapToObjectTransformerTests { assertEquals("Case", person.getLname()); assertNull(person.getSsn()); assertNotNull(person.getAddress()); - assertTrue(person.getAddress() instanceof Address); assertEquals("1123 Main st", person.getAddress().getStreet()); } @@ -133,7 +130,6 @@ public class MapToObjectTransformerTests { assertEquals("Justin", person.getFname()); assertEquals("Case", person.getLname()); assertNotNull(person.getAddress()); - assertTrue(person.getAddress() instanceof Address); assertEquals("1123 Main st", person.getAddress().getStreet()); } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/util/DefaultMethodInvokerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/util/DefaultMethodInvokerTests.java index fe411cac72..bcc4fa42aa 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/util/DefaultMethodInvokerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/util/DefaultMethodInvokerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -114,6 +114,7 @@ public class DefaultMethodInvokerTests { } + @SuppressWarnings("unused") private static class TestBean { String lastStringArgument; diff --git a/spring-integration-event/src/main/java/org/springframework/integration/event/ApplicationEventInboundChannelAdapter.java b/spring-integration-event/src/main/java/org/springframework/integration/event/ApplicationEventInboundChannelAdapter.java index a47372f4ff..064789f583 100644 --- a/spring-integration-event/src/main/java/org/springframework/integration/event/ApplicationEventInboundChannelAdapter.java +++ b/spring-integration-event/src/main/java/org/springframework/integration/event/ApplicationEventInboundChannelAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,7 @@ import org.springframework.util.CollectionUtils; * * @author Mark Fisher */ -public class ApplicationEventInboundChannelAdapter extends MessageProducerSupport implements ApplicationListener { +public class ApplicationEventInboundChannelAdapter extends MessageProducerSupport implements ApplicationListener { private final List> eventTypes = new CopyOnWriteArrayList>(); diff --git a/spring-integration-event/src/main/java/org/springframework/integration/event/ApplicationEventPublishingMessageHandler.java b/spring-integration-event/src/main/java/org/springframework/integration/event/ApplicationEventPublishingMessageHandler.java index 91c65fac6b..6e9a191d44 100644 --- a/spring-integration-event/src/main/java/org/springframework/integration/event/ApplicationEventPublishingMessageHandler.java +++ b/spring-integration-event/src/main/java/org/springframework/integration/event/ApplicationEventPublishingMessageHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -43,7 +43,7 @@ public class ApplicationEventPublishingMessageHandler extends AbstractMessage @Override protected void handleMessageInternal(Message message) { Assert.notNull(this.applicationEventPublisher, "applicationEventPublisher is required"); - this.applicationEventPublisher.publishEvent(new MessagingEvent((Message) message)); + this.applicationEventPublisher.publishEvent(new MessagingEvent(message)); } } diff --git a/spring-integration-event/src/main/java/org/springframework/integration/event/MessagingEvent.java b/spring-integration-event/src/main/java/org/springframework/integration/event/MessagingEvent.java index 0d5ef62e3e..5ff65dce17 100644 --- a/spring-integration-event/src/main/java/org/springframework/integration/event/MessagingEvent.java +++ b/spring-integration-event/src/main/java/org/springframework/integration/event/MessagingEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,6 +26,8 @@ import org.springframework.integration.core.Message; */ public class MessagingEvent extends ApplicationEvent { + private static final long serialVersionUID = -872581247155846293L; + public MessagingEvent(Message message) { super(message); } diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java b/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java index 3ca7036f35..58c5598b10 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java @@ -180,7 +180,7 @@ public class FileWritingMessageHandler extends AbstractReplyProducingMessageHand if (resultFile != null) { if (originalFileFromHeader == null && payload instanceof File) { return MessageBuilder.withPayload(resultFile) - .setHeader(FileHeaders.ORIGINAL_FILE, (File) payload); + .setHeader(FileHeaders.ORIGINAL_FILE, payload); } } return resultFile; diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileListFilterFactoryBean.java b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileListFilterFactoryBean.java index be3a300f6c..fa98a9bc0c 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileListFilterFactoryBean.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileListFilterFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,7 @@ import org.springframework.integration.file.PatternMatchingFileListFilter; * @author Mark Fisher * @since 1.0.3 */ -public class FileListFilterFactoryBean implements FactoryBean { +public class FileListFilterFactoryBean implements FactoryBean { private volatile FileListFilter fileListFilter; @@ -55,7 +55,7 @@ public class FileListFilterFactoryBean implements FactoryBean { this.preventDuplicates = preventDuplicates; } - public Object getObject() throws Exception { + public FileListFilter getObject() throws Exception { if (this.fileListFilter == null) { synchronized (this.monitor) { this.intializeFileListFilter(); diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileReadingMessageSourceFactoryBean.java b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileReadingMessageSourceFactoryBean.java index 6293bc5697..09d5cfab4f 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileReadingMessageSourceFactoryBean.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileReadingMessageSourceFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -33,7 +33,7 @@ import java.util.Comparator; * @author Iwein Fuld * @since 1.0.3 */ -public class FileReadingMessageSourceFactoryBean implements FactoryBean { +public class FileReadingMessageSourceFactoryBean implements FactoryBean { private static Log logger = LogFactory.getLog(FileReadingMessageSourceFactoryBean.class); @@ -92,7 +92,7 @@ public class FileReadingMessageSourceFactoryBean implements FactoryBean { this.locker = locker; } - public Object getObject() throws Exception { + public FileReadingMessageSource getObject() throws Exception { if (this.source == null) { initSource(); } diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerFactoryBean.java b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerFactoryBean.java index c73d66768e..3f3495139f 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerFactoryBean.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,8 @@ import org.springframework.util.Assert; * @author Mark Fisher * @since 1.0.3 */ -public class FileWritingMessageHandlerFactoryBean implements FactoryBean, BeanFactoryAware, ResourceLoaderAware { +public class FileWritingMessageHandlerFactoryBean implements FactoryBean, + BeanFactoryAware, ResourceLoaderAware { private volatile FileWritingMessageHandler handler; @@ -117,7 +118,7 @@ public class FileWritingMessageHandlerFactoryBean implements FactoryBean, BeanFa this.order = order; } - public Object getObject() throws Exception { + public FileWritingMessageHandler getObject() throws Exception { if (this.handler == null) { initHandler(); } diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileListFilterFactoryBeanTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileListFilterFactoryBeanTests.java index c67a6b0b2b..be9424c178 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileListFilterFactoryBeanTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/config/FileListFilterFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -45,7 +45,7 @@ public class FileListFilterFactoryBeanTests { FileListFilterFactoryBean factory = new FileListFilterFactoryBean(); TestFilter testFilter = new TestFilter(); factory.setFilterReference(testFilter); - FileListFilter result = (FileListFilter) factory.getObject(); + FileListFilter result = factory.getObject(); assertFalse(result instanceof CompositeFileListFilter); assertSame(testFilter, result); } @@ -57,7 +57,7 @@ public class FileListFilterFactoryBeanTests { TestFilter testFilter = new TestFilter(); factory.setFilterReference(testFilter); factory.setPreventDuplicates(Boolean.TRUE); - FileListFilter result = (FileListFilter) factory.getObject(); + FileListFilter result = factory.getObject(); assertTrue(result instanceof CompositeFileListFilter); Collection filters = (Collection) new DirectFieldAccessor(result).getPropertyValue("fileFilters"); assertTrue(filters.iterator().next() instanceof AcceptOnceFileListFilter); @@ -70,7 +70,7 @@ public class FileListFilterFactoryBeanTests { TestFilter testFilter = new TestFilter(); factory.setFilterReference(testFilter); factory.setPreventDuplicates(Boolean.FALSE); - FileListFilter result = (FileListFilter) factory.getObject(); + FileListFilter result = factory.getObject(); assertFalse(result instanceof CompositeFileListFilter); assertSame(testFilter, result); } @@ -80,7 +80,7 @@ public class FileListFilterFactoryBeanTests { public void filenamePatternAndPreventDuplicatesNull() throws Exception { FileListFilterFactoryBean factory = new FileListFilterFactoryBean(); factory.setFilenamePattern(Pattern.compile("foo")); - FileListFilter result = (FileListFilter) factory.getObject(); + FileListFilter result = factory.getObject(); assertTrue(result instanceof CompositeFileListFilter); Collection filters = (Collection) new DirectFieldAccessor(result).getPropertyValue("fileFilters"); Iterator iterator = filters.iterator(); @@ -94,7 +94,7 @@ public class FileListFilterFactoryBeanTests { FileListFilterFactoryBean factory = new FileListFilterFactoryBean(); factory.setFilenamePattern(Pattern.compile("foo")); factory.setPreventDuplicates(Boolean.TRUE); - FileListFilter result = (FileListFilter) factory.getObject(); + FileListFilter result = factory.getObject(); assertTrue(result instanceof CompositeFileListFilter); Collection filters = (Collection) new DirectFieldAccessor(result).getPropertyValue("fileFilters"); Iterator iterator = filters.iterator(); @@ -107,7 +107,7 @@ public class FileListFilterFactoryBeanTests { FileListFilterFactoryBean factory = new FileListFilterFactoryBean(); factory.setFilenamePattern(Pattern.compile("foo")); factory.setPreventDuplicates(Boolean.FALSE); - FileListFilter result = (FileListFilter) factory.getObject(); + FileListFilter result = factory.getObject(); assertFalse(result instanceof CompositeFileListFilter); assertTrue(result instanceof PatternMatchingFileListFilter); } diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/locking/NioFileLockerTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/locking/NioFileLockerTests.java index 5f4ab31acf..bf27ef566a 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/locking/NioFileLockerTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/locking/NioFileLockerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -66,7 +66,7 @@ public class NioFileLockerTests { testFile.createNewFile(); assertThat(filter1.filterFiles(workdir.listFiles()).get(0), is(testFile)); filter1.lock(testFile); - assertThat(filter2.filterFiles(workdir.listFiles()), is((List)new ArrayList())); + assertThat(filter2.filterFiles(workdir.listFiles()), is((List)new ArrayList())); } } \ No newline at end of file diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/recursive/FileInboundChannelAdapterWithRecursiveDirectoryTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/recursive/FileInboundChannelAdapterWithRecursiveDirectoryTests.java index 641d85c1af..7ad2a43e3d 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/recursive/FileInboundChannelAdapterWithRecursiveDirectoryTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/recursive/FileInboundChannelAdapterWithRecursiveDirectoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -31,7 +31,6 @@ import java.util.Arrays; import java.util.List; import static org.junit.Assert.assertThat; -import static org.junit.matchers.JUnitMatchers.hasItem; import static org.junit.matchers.JUnitMatchers.hasItems; import static org.springframework.integration.test.matcher.PayloadMatcher.hasPayload; @@ -60,7 +59,8 @@ public class FileInboundChannelAdapterWithRecursiveDirectoryTests { assertThat(files.receive(), hasPayload(file)); } - @Test(timeout = 2000) + @Test(timeout = 2000) + @SuppressWarnings("unchecked") public void shouldReturnFilesMultipleLevels() throws IOException { //when diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/DefaultInboundRequestMapper.java b/spring-integration-http/src/main/java/org/springframework/integration/http/DefaultInboundRequestMapper.java index aac57e4980..9883fff0da 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/DefaultInboundRequestMapper.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/DefaultInboundRequestMapper.java @@ -202,7 +202,7 @@ public class DefaultInboundRequestMapper implements InboundRequestMapper { @SuppressWarnings("unchecked") private Object createPayloadFromMultipartRequest(MultipartHttpServletRequest multipartRequest) { Map payloadMap = new HashMap(multipartRequest.getParameterMap()); - Map fileMap = (Map) multipartRequest.getFileMap(); + Map fileMap = multipartRequest.getFileMap(); for (Map.Entry entry : fileMap.entrySet()) { MultipartFile multipartFile = entry.getValue(); if (multipartFile.isEmpty()) { @@ -300,6 +300,7 @@ public class DefaultInboundRequestMapper implements InboundRequestMapper { * The contents of the map are unmodifiable, so calling any modification operation * (e.g. put, add, or remove) will result in an UnsupportedOperationException. */ + @SuppressWarnings("serial") private static class UnmodifiableRequestParameterMap extends LinkedMultiValueMap implements Serializable { // TODO: in 3.0.1 LMVM implements Serializable diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/HttpInboundEndpoint.java b/spring-integration-http/src/main/java/org/springframework/integration/http/HttpInboundEndpoint.java index 5b25ec0c51..9de09b8ec5 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/HttpInboundEndpoint.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/HttpInboundEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -187,7 +187,7 @@ public class HttpInboundEndpoint extends SimpleMessagingGateway implements HttpR DefaultInboundRequestMapper defaultMapper = new DefaultInboundRequestMapper(); if (this.getBeanFactory() != null) { try { - MultipartResolver multipartResolver = (MultipartResolver) + MultipartResolver multipartResolver = this.getBeanFactory().getBean(DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME, MultipartResolver.class); if (logger.isDebugEnabled()) { logger.debug("Using MultipartResolver [" + multipartResolver + "]"); diff --git a/spring-integration-httpinvoker/src/test/java/org/springframework/integration/httpinvoker/HttpInvokerInboundGatewayTests.java b/spring-integration-httpinvoker/src/test/java/org/springframework/integration/httpinvoker/HttpInvokerInboundGatewayTests.java index 121e488e51..38a57e9beb 100644 --- a/spring-integration-httpinvoker/src/test/java/org/springframework/integration/httpinvoker/HttpInvokerInboundGatewayTests.java +++ b/spring-integration-httpinvoker/src/test/java/org/springframework/integration/httpinvoker/HttpInvokerInboundGatewayTests.java @@ -42,6 +42,7 @@ import org.springframework.remoting.support.RemoteInvocationResult; /** * @author Mark Fisher */ +@SuppressWarnings("deprecation") public class HttpInvokerInboundGatewayTests { @Test @@ -104,7 +105,7 @@ public class HttpInvokerInboundGatewayTests { ObjectInputStream ois = new ObjectInputStream(bais); RemoteInvocationResult remoteResult = (RemoteInvocationResult) ois.readObject(); Object resultValue = remoteResult.getValue(); - assertTrue(resultValue instanceof Message); + assertTrue(resultValue instanceof Message); return (Message) resultValue; } diff --git a/spring-integration-httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/HttpInvokerInboundGatewayParserTests.java b/spring-integration-httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/HttpInvokerInboundGatewayParserTests.java index 5af9a19821..b8a75ebe14 100644 --- a/spring-integration-httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/HttpInvokerInboundGatewayParserTests.java +++ b/spring-integration-httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/HttpInvokerInboundGatewayParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,6 +30,7 @@ import org.springframework.integration.httpinvoker.HttpInvokerInboundGateway; /** * @author Mark Fisher */ +@SuppressWarnings("deprecation") public class HttpInvokerInboundGatewayParserTests { @Test diff --git a/spring-integration-httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/HttpInvokerOutboundGatewayParserTests.java b/spring-integration-httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/HttpInvokerOutboundGatewayParserTests.java index 97d94fe18c..8999c5f58e 100644 --- a/spring-integration-httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/HttpInvokerOutboundGatewayParserTests.java +++ b/spring-integration-httpinvoker/src/test/java/org/springframework/integration/httpinvoker/config/HttpInvokerOutboundGatewayParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,6 +29,7 @@ import org.springframework.integration.httpinvoker.HttpInvokerOutboundGateway; /** * @author Mark Fisher */ +@SuppressWarnings("deprecation") public class HttpInvokerOutboundGatewayParserTests { @Test diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/IpHeaders.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/IpHeaders.java index e2eae2c845..7114ff0944 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/IpHeaders.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/IpHeaders.java @@ -34,8 +34,6 @@ public abstract class IpHeaders { private static final String TCP = IP + "tcp_"; - private static final String UDP = IP + "udp_"; - public static final String HOSTNAME = IP + "hostname"; public static final String IP_ADDRESS = IP + "address"; diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/config/IpOutboundGatewayParser.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/config/IpOutboundGatewayParser.java index 02d85ad648..ac61531ff3 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/config/IpOutboundGatewayParser.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/config/IpOutboundGatewayParser.java @@ -16,13 +16,11 @@ package org.springframework.integration.ip.config; -import org.w3c.dom.Element; - import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.integration.config.xml.AbstractConsumerEndpointParser; import org.springframework.integration.config.xml.IntegrationNamespaceUtils; -import org.springframework.util.StringUtils; +import org.w3c.dom.Element; /** * Parser for the <outbound-gateway> element of the integration 'jms' namespace. diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SimpleTcpNetInboundGatewayTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SimpleTcpNetInboundGatewayTests.java index 0dbad881ff..5f39dbdb61 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SimpleTcpNetInboundGatewayTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SimpleTcpNetInboundGatewayTests.java @@ -21,7 +21,6 @@ import java.net.Socket; import javax.net.SocketFactory; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SocketMessageMapperTests.java b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SocketMessageMapperTests.java index 798d3e0d8c..c551e2bcc7 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SocketMessageMapperTests.java +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/SocketMessageMapperTests.java @@ -46,7 +46,7 @@ public class SocketMessageMapperTests { public void testToMessage() throws Exception { SocketMessageMapper mapper = new SocketMessageMapper(); Message message = mapper.toMessage(new StubSocketReader()); - assertEquals(TEST_PAYLOAD, new String((byte[]) message.getPayload())); + assertEquals(TEST_PAYLOAD, new String(message.getPayload())); assertEquals(InetAddress.getLocalHost().getHostName(), message .getHeaders().get(IpHeaders.HOSTNAME)); assertEquals(InetAddress.getLocalHost().getHostAddress(), message diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java index 5151bd73a4..76f806b0cd 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java @@ -44,7 +44,7 @@ import org.springframework.util.Assert; * @author Mark Fisher * @author Juergen Hoeller */ -public class ChannelPublishingJmsMessageListener implements SessionAwareMessageListener, InitializingBean { +public class ChannelPublishingJmsMessageListener implements SessionAwareMessageListener, InitializingBean { private volatile boolean expectReply; @@ -238,7 +238,7 @@ public class ChannelPublishingJmsMessageListener implements SessionAwareMessageL public void onMessage(javax.jms.Message jmsMessage, Session session) throws JMSException { Object object = this.messageConverter.fromMessage(jmsMessage); - Message requestMessage = (object instanceof Message) ? + Message requestMessage = (object instanceof Message) ? (Message) object : MessageBuilder.withPayload(object).build(); if (!this.expectReply) { boolean sent = this.channelTemplate.send(requestMessage); diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/HeaderMappingMessageConverter.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/HeaderMappingMessageConverter.java index 72c8b4d5d0..1d7c450fd3 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/HeaderMappingMessageConverter.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/HeaderMappingMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -142,7 +142,7 @@ public class HeaderMappingMessageConverter implements MessageConverter { if (conversionResult == null) { return null; } - if (conversionResult instanceof Message) { + if (conversionResult instanceof Message) { builder = MessageBuilder.fromMessage((Message) conversionResult); } else { @@ -166,7 +166,7 @@ public class HeaderMappingMessageConverter implements MessageConverter { public javax.jms.Message toMessage(Object object, Session session) throws JMSException, MessageConversionException { MessageHeaders headers = null; javax.jms.Message jmsMessage = null; - if (object instanceof Message) { + if (object instanceof Message) { headers = ((Message) object).getHeaders(); if (this.extractIntegrationMessagePayload) { object = ((Message) object).getPayload(); diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/MailReceiverFactoryBean.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/MailReceiverFactoryBean.java index 8c8b4dae3d..f1206a0280 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/MailReceiverFactoryBean.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/config/MailReceiverFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,7 @@ import org.springframework.util.Assert; * @author Mark Fisher * @since 1.0.3 */ -public class MailReceiverFactoryBean implements FactoryBean, DisposableBean { +public class MailReceiverFactoryBean implements FactoryBean, DisposableBean { private volatile String storeUri; @@ -53,7 +53,7 @@ public class MailReceiverFactoryBean implements FactoryBean, DisposableBean { this.maxFetchSize = maxFetchSize; } - public Object getObject() throws Exception { + public MailReceiver getObject() throws Exception { if (this.receiver == null) { this.receiver = this.createReceiver(); } diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceivingMessageSourceTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceivingMessageSourceTests.java index 8f570ddf8e..e3802c7e00 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceivingMessageSourceTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailReceivingMessageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -53,6 +53,7 @@ public class MailReceivingMessageSourceTests { } + @SuppressWarnings("unused") private static class StubMailReceiver implements MailReceiver { private final ConcurrentLinkedQueue messages = new ConcurrentLinkedQueue(); diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerTests.java index 54b749685a..0b3cc51218 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/MailSendingMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -112,7 +112,7 @@ public class MailSendingMessageHandlerTests { @Test public void simpleMailMessageOverrideWithHeaders() { SimpleMailMessage mailMessage = MailTestsHelper.createSimpleMailMessage(); - String[] toHeaders = mailMessage.getTo(); + mailMessage.getTo(); this.handler.handleMessage(MessageBuilder.withPayload(mailMessage).setHeader(MailHeaders.TO, new String[]{"foo@bar.bam"}).build()); assertEquals("only one simple message must be sent", 1, mailSender.getSentSimpleMailMessages().size()); diff --git a/spring-integration-security/src/main/java/org/springframework/integration/security/channel/ChannelInvocation.java b/spring-integration-security/src/main/java/org/springframework/integration/security/channel/ChannelInvocation.java index cc99899981..9e89ec4428 100644 --- a/spring-integration-security/src/main/java/org/springframework/integration/security/channel/ChannelInvocation.java +++ b/spring-integration-security/src/main/java/org/springframework/integration/security/channel/ChannelInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -48,7 +48,7 @@ public class ChannelInvocation { "MethodInvocation must be on a MessageChannel"); this.channel = (MessageChannel) methodInvocation.getThis(); if (methodInvocation.getMethod().getName().equals("send")) { - if (methodInvocation.getArguments().length < 1 || !(methodInvocation.getArguments()[0] instanceof Message)) { + if (methodInvocation.getArguments().length < 1 || !(methodInvocation.getArguments()[0] instanceof Message)) { throw new IllegalStateException("expected a Message as the first parameter of the channel's send method"); } this.message = (Message) methodInvocation.getArguments()[0]; diff --git a/spring-integration-security/src/main/java/org/springframework/integration/security/config/SecuredChannelsParser.java b/spring-integration-security/src/main/java/org/springframework/integration/security/config/SecuredChannelsParser.java index 1b4aa93f22..a778b025a1 100644 --- a/spring-integration-security/src/main/java/org/springframework/integration/security/config/SecuredChannelsParser.java +++ b/spring-integration-security/src/main/java/org/springframework/integration/security/config/SecuredChannelsParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -72,7 +72,7 @@ public class SecuredChannelsParser extends AbstractSingleBeanDefinitionParser { private String parseObjectDefinitionSource(Element element, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition( BASE_PACKAGE_NAME + ".channel.ChannelInvocationDefinitionSource"); - List accessPolicyElements = (List) DomUtils.getChildElementsByTagName(element, "access-policy"); + List accessPolicyElements = DomUtils.getChildElementsByTagName(element, "access-policy"); ManagedMap patternMappings = new ManagedMap(); for (Element accessPolicyElement : accessPolicyElements) { Pattern pattern = Pattern.compile(accessPolicyElement.getAttribute("pattern")); diff --git a/spring-integration-security/src/test/java/org/springframework/integration/security/config/SecuredChannelsParserTests.java b/spring-integration-security/src/test/java/org/springframework/integration/security/config/SecuredChannelsParserTests.java index f2872de8ed..c08a831e97 100644 --- a/spring-integration-security/src/test/java/org/springframework/integration/security/config/SecuredChannelsParserTests.java +++ b/spring-integration-security/src/test/java/org/springframework/integration/security/config/SecuredChannelsParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -31,7 +31,6 @@ import java.util.regex.Pattern; import org.junit.Before; import org.junit.Test; - import org.springframework.aop.Advisor; import org.springframework.aop.framework.Advised; import org.springframework.aop.support.AopUtils; @@ -41,7 +40,6 @@ import org.springframework.integration.channel.ChannelInterceptor; import org.springframework.integration.core.Message; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.security.channel.ChannelAccessPolicy; -import org.springframework.integration.security.channel.ChannelInvocationDefinitionSource; import org.springframework.integration.security.channel.ChannelSecurityInterceptor; import org.springframework.integration.selector.MessageSelector; import org.springframework.security.ConfigAttribute; @@ -165,7 +163,7 @@ public class SecuredChannelsParserTests extends AbstractJUnit4SpringContextTests @SuppressWarnings("unchecked") private ChannelAccessPolicy retrievePolicyForPatternString(String patternString, ChannelSecurityInterceptor interceptor) { - DirectFieldAccessor accessor = new DirectFieldAccessor((ChannelInvocationDefinitionSource) interceptor.obtainObjectDefinitionSource()); + DirectFieldAccessor accessor = new DirectFieldAccessor(interceptor.obtainObjectDefinitionSource()); Map policies = (Map) accessor.getPropertyValue("patternMappings"); for (Map.Entry entry : policies.entrySet()) { if (entry.getKey().pattern().equals(patternString)) { diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java index 1cb61090aa..1fe6c265c2 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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,7 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG DOMResult result = new DOMResult(); this.getWebServiceTemplate().sendSourceAndReceiveToResult( new DOMSource((Document) requestPayload), requestCallback, result); - return (Document)result.getNode(); + return result.getNode(); } throw new MessagingException("Unsupported payload type '" + requestPayload.getClass() + "'. " + this.getClass().getName() + " only supports 'java.lang.String', '" + Source.class.getName() + diff --git a/spring-integration-xml/src/test/java/org/springframework/integration/xml/DefaultXmlPayloadConverterTests.java b/spring-integration-xml/src/test/java/org/springframework/integration/xml/DefaultXmlPayloadConverterTests.java index 458f7c3056..2622d1e90b 100644 --- a/spring-integration-xml/src/test/java/org/springframework/integration/xml/DefaultXmlPayloadConverterTests.java +++ b/spring-integration-xml/src/test/java/org/springframework/integration/xml/DefaultXmlPayloadConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2010 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. @@ -70,7 +70,7 @@ public class DefaultXmlPayloadConverterTests { @Test public void testGetNodePassingNode() { - Node element = (Node) testDocument.getElementsByTagName("test").item(0); + Node element = testDocument.getElementsByTagName("test").item(0); Node n = converter.convertToNode(element); assertTrue("Wrong node returned", element == n); } @@ -114,7 +114,7 @@ public class DefaultXmlPayloadConverterTests { @Test public void testGetNodePassingDOMSource(){ - Node element = (Node) testDocument.getElementsByTagName("test").item(0); + Node element = testDocument.getElementsByTagName("test").item(0); Node n = converter.convertToNode(new DOMSource(element)); assertTrue("Wrong node returned", element == n); }