diff --git a/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java b/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java index cf1a50218b..bb8cc2305f 100644 --- a/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java +++ b/spring-integration-event/src/main/java/org/springframework/integration/event/inbound/ApplicationEventListeningMessageProducer.java @@ -16,6 +16,7 @@ package org.springframework.integration.event.inbound; +import java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -31,7 +32,6 @@ import org.springframework.integration.Message; import org.springframework.integration.endpoint.ExpressionMessageProducerSupport; import org.springframework.integration.support.MessageBuilder; import org.springframework.util.Assert; -import org.springframework.util.CollectionUtils; /** * An inbound Channel Adapter that implements {@link ApplicationListener} and @@ -69,9 +69,9 @@ public class ApplicationEventListeningMessageProducer extends ExpressionMessageP * @see ApplicationEventMulticaster#addApplicationListener * @see #supportsEventType */ - @SuppressWarnings("unchecked") public void setEventTypes(Class... eventTypes) { - Set> eventSet = new HashSet>(CollectionUtils.arrayToList(eventTypes)); + Set> eventSet = new HashSet>( + Arrays.asList(eventTypes)); eventSet.remove(null); this.eventTypes = (eventSet.size() > 0 ? eventSet : null); diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionEventListeningMessageProducer.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionEventListeningMessageProducer.java index b63c754fdf..8a63a71dac 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionEventListeningMessageProducer.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionEventListeningMessageProducer.java @@ -15,6 +15,7 @@ */ package org.springframework.integration.ip.tcp.connection; +import java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -44,14 +45,14 @@ public class TcpConnectionEventListeningMessageProducer extends MessageProducerS * this adapter should send to the message channel. By default, all event * types will be sent. */ - @SuppressWarnings("unchecked") public void setEventTypes(Class[] eventTypes) { Assert.notEmpty(eventTypes, "at least one event type is required"); Set> eventTypeSet = new HashSet>(); - eventTypeSet.addAll(CollectionUtils.arrayToList(eventTypes)); + eventTypeSet.addAll(Arrays.asList(eventTypes)); this.eventTypes = eventTypeSet; } + @Override public void onApplicationEvent(TcpConnectionEvent event) { if (this.isRunning()) { if (CollectionUtils.isEmpty(this.eventTypes)) { diff --git a/spring-integration-security/src/test/java/org/springframework/integration/security/SecurityTestUtils.java b/spring-integration-security/src/test/java/org/springframework/integration/security/SecurityTestUtils.java index b7bfd4fb78..21814c4f42 100644 --- a/spring-integration-security/src/test/java/org/springframework/integration/security/SecurityTestUtils.java +++ b/spring-integration-security/src/test/java/org/springframework/integration/security/SecurityTestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2013 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,20 +16,21 @@ package org.springframework.integration.security; +import java.util.Arrays; + import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextImpl; -import org.springframework.util.CollectionUtils; /** * @author Jonas Partner * @author Oleg Zhurakousky + * @author Gary Russell */ public class SecurityTestUtils { - @SuppressWarnings("unchecked") public static SecurityContext createContext(String username, String password, String... roles) { SecurityContextImpl ctxImpl = new SecurityContextImpl(); UsernamePasswordAuthenticationToken authToken; @@ -38,7 +39,8 @@ public class SecurityTestUtils { for (int i = 0; i < roles.length; i++) { authorities[i] = new SimpleGrantedAuthority(roles[i]); } - authToken = new UsernamePasswordAuthenticationToken(username, password, CollectionUtils.arrayToList(authorities)); + authToken = new UsernamePasswordAuthenticationToken(username, password, + Arrays.asList(authorities)); } else { authToken = new UsernamePasswordAuthenticationToken(username, password); diff --git a/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java b/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java index 5639dc9641..487739fe7f 100644 --- a/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java +++ b/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.integration.xml.selector; import java.io.IOException; +import java.util.Arrays; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -31,7 +32,6 @@ import org.springframework.integration.xml.AggregatedXmlMessageValidationExcepti import org.springframework.integration.xml.DefaultXmlPayloadConverter; import org.springframework.integration.xml.XmlPayloadConverter; import org.springframework.util.Assert; -import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; import org.springframework.xml.validation.XmlValidator; @@ -39,6 +39,7 @@ import org.springframework.xml.validation.XmlValidatorFactory; /** * @author Oleg Zhurakousky + * @author Gary Russell * @since 2.0 */ public class XmlValidatingMessageSelector implements MessageSelector { @@ -62,7 +63,7 @@ public class XmlValidatingMessageSelector implements MessageSelector { * the provided 'schema' location {@link Resource} and 'schemaType'. The valid options for schema * type are {@link XmlValidatorFactory#SCHEMA_W3C_XML} or {@link XmlValidatorFactory#SCHEMA_RELAX_NG}. * If no 'schemaType' is provided it will default to {@link XmlValidatorFactory#SCHEMA_W3C_XML}; - * + * * @throws IOException if the XmlValidatorFactory fails to create a validator */ public XmlValidatingMessageSelector(Resource schema, String schemaType) throws IOException { @@ -86,7 +87,7 @@ public class XmlValidatingMessageSelector implements MessageSelector { this.converter = converter; } - @SuppressWarnings("unchecked") + @Override public boolean accept(Message message) { SAXParseException[] validationExceptions = null; try { @@ -98,8 +99,9 @@ public class XmlValidatingMessageSelector implements MessageSelector { boolean validationSuccess = ObjectUtils.isEmpty(validationExceptions); if (!validationSuccess) { if (this.throwExceptionOnRejection) { - throw new MessageRejectedException(message, "Message was rejected due to XML Validation errors", - new AggregatedXmlMessageValidationException(CollectionUtils.arrayToList(validationExceptions))); + throw new MessageRejectedException(message, "Message was rejected due to XML Validation errors", + new AggregatedXmlMessageValidationException( + Arrays. asList(validationExceptions))); } if (logger.isDebugEnabled()) { logger.debug("Message was rejected due to XML Validation errors");