diff --git a/spring-integration-core/src/main/java/org/springframework/integration/MessageSourceReceiveException.java b/spring-integration-core/src/main/java/org/springframework/integration/MessageSourceReceiveException.java deleted file mode 100644 index 5a057672b1..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/MessageSourceReceiveException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2002-2011 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; - -/** - * @author Oleg Zhurakousky - * @since 2.0.2 - */ -@SuppressWarnings("serial") -public class MessageSourceReceiveException extends MessageHandlingException { - - private volatile Object errorChannel; - - public void setErrorChannel(Object errorChannel) { - this.errorChannel = errorChannel; - } - - public MessageSourceReceiveException(Object errorChannel, Throwable t) { - super(null, t); - this.errorChannel = errorChannel; - } - - public Object getErrorChannel() { - return errorChannel; - } - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/MessagePublishingErrorHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/MessagePublishingErrorHandler.java index c0156ccaa8..712d6705ca 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/MessagePublishingErrorHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/MessagePublishingErrorHandler.java @@ -23,7 +23,6 @@ import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.integration.Message; import org.springframework.integration.MessageChannel; -import org.springframework.integration.MessageSourceReceiveException; import org.springframework.integration.MessagingException; import org.springframework.integration.context.IntegrationContextUtils; import org.springframework.integration.message.ErrorMessage; @@ -31,7 +30,6 @@ import org.springframework.integration.support.channel.BeanFactoryChannelResolve import org.springframework.integration.support.channel.ChannelResolver; import org.springframework.util.Assert; import org.springframework.util.ErrorHandler; -import org.springframework.util.StringUtils; /** * {@link ErrorHandler} implementation that sends an {@link ErrorMessage} to a @@ -114,20 +112,6 @@ public class MessagePublishingErrorHandler implements ErrorHandler, BeanFactoryA IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); } - if (t instanceof MessageSourceReceiveException){ - Object errorChannel = ((MessageSourceReceiveException)t).getErrorChannel(); - if (errorChannel != null){ - if (errorChannel instanceof MessageChannel){ - return (MessageChannel) errorChannel; - } - else if (errorChannel instanceof String && StringUtils.hasText((String)errorChannel)){ - return this.channelResolver.resolveChannelName((String) errorChannel); - } - else { - throw new MessagingException("Failed to resolve 'errorChannel' - " + errorChannel); - } - } - } if (failedMessage == null || failedMessage.getHeaders().getErrorChannel() == null) { return this.defaultErrorChannel; } 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 55d7dd66f5..3d471d3661 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 @@ -30,7 +30,6 @@ import org.springframework.integration.core.MessageSource; import org.springframework.integration.endpoint.SourcePollingChannelAdapter; import org.springframework.integration.scheduling.PollerMetadata; import org.springframework.util.Assert; -import org.springframework.util.ErrorHandler; /** * FactoryBean for creating a SourcePollingChannelAdapter instance. @@ -60,13 +59,6 @@ public class SourcePollingChannelAdapterFactoryBean implements FactoryBean source) { this.source = source; @@ -127,7 +119,6 @@ public class SourcePollingChannelAdapterFactoryBean implements FactoryBean extends AbstractExpressionEvaluat @SuppressWarnings("unchecked") public final Message receive() { Message message = null; - Object result = null; + Object result = this.doReceive(); Map headers = this.evaluateHeaders(); - if (headers.containsKey(MessageHeaders.ERROR_CHANNEL)){ - try { - result = this.doReceive(); - } - catch (Exception e) { - throw new MessageSourceReceiveException((String) headers.get(MessageHeaders.ERROR_CHANNEL), e); - } - } - else { - result = this.doReceive(); - } - if (result instanceof Message) { try { message = (Message) result; diff --git a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd index b17730c1f3..a0e77dd259 100644 --- a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd +++ b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.0.xsd @@ -694,15 +694,6 @@ - - - - - diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel.java index 3a135f0d25..46538be584 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel.java @@ -17,6 +17,7 @@ package org.springframework.integration.config.xml; import static junit.framework.Assert.assertNotNull; +import org.junit.Ignore; import org.junit.Test; import org.springframework.context.ApplicationContext; @@ -31,6 +32,7 @@ import org.springframework.integration.endpoint.SourcePollingChannelAdapter; public class PollerWithErrorChannel { @Test + @Ignore public void testWithErrorChannelAsHeader() throws Exception{ ApplicationContext ac = new ClassPathXmlApplicationContext("PollerWithErrorChannel-context.xml", this.getClass()); SourcePollingChannelAdapter adapter = ac.getBean("withErrorHeader", SourcePollingChannelAdapter.class); @@ -41,6 +43,7 @@ public class PollerWithErrorChannel { } @Test + @Ignore public void testWithErrorChannel() throws Exception{ ApplicationContext ac = new ClassPathXmlApplicationContext("PollerWithErrorChannel-context.xml", this.getClass()); SourcePollingChannelAdapter adapter = ac.getBean("withErrorChannel", SourcePollingChannelAdapter.class); @@ -51,6 +54,7 @@ public class PollerWithErrorChannel { } @Test + @Ignore public void testWithErrorChannelAndHeader() throws Exception{ ApplicationContext ac = new ClassPathXmlApplicationContext("PollerWithErrorChannel-context.xml", this.getClass()); SourcePollingChannelAdapter adapter = ac.getBean("withErrorChannelAndHeader", SourcePollingChannelAdapter.class);