Removing dependencies on ConfigurationException.

This commit is contained in:
Mark Fisher
2008-10-10 00:57:05 +00:00
parent 01c9efef66
commit b68f7ca17a
9 changed files with 35 additions and 56 deletions

View File

@@ -22,7 +22,6 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.message.MessageSource;
import org.springframework.integration.message.MessagingException;
import org.springframework.integration.message.StringMessage;
@@ -84,7 +83,7 @@ public class CharacterStreamSource implements MessageSource<String> {
return new CharacterStreamSource(new InputStreamReader(System.in, charsetName));
}
catch (UnsupportedEncodingException e) {
throw new ConfigurationException("unsupported encoding: " + charsetName, e);
throw new IllegalArgumentException("unsupported encoding: " + charsetName, e);
}
}

View File

@@ -26,7 +26,6 @@ import java.io.Writer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageConsumer;
import org.springframework.integration.message.MessagingException;
@@ -108,7 +107,7 @@ public class CharacterStreamWritingMessageConsumer implements MessageConsumer {
return new CharacterStreamWritingMessageConsumer(new OutputStreamWriter(stream, charsetName));
}
catch (UnsupportedEncodingException e) {
throw new ConfigurationException("unsupported encoding: " + charsetName, e);
throw new IllegalArgumentException("unsupported encoding: " + charsetName, e);
}
}

View File

@@ -32,7 +32,6 @@ import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageSource;
@@ -99,9 +98,9 @@ public class ConsoleInboundChannelAdapterParserTests {
beanCreationException = e;
}
Throwable parentCause = beanCreationException.getCause().getCause();
assertEquals(ConfigurationException.class, parentCause.getClass());
Throwable configurationExceptionCause = ((ConfigurationException) parentCause).getCause();
assertEquals(UnsupportedEncodingException.class, configurationExceptionCause.getClass());
assertEquals(IllegalArgumentException.class, parentCause.getClass());
Throwable rootCause = ((IllegalArgumentException) parentCause).getCause();
assertEquals(UnsupportedEncodingException.class, rootCause.getClass());
}
}

View File

@@ -32,7 +32,6 @@ import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.message.StringMessage;
import org.springframework.integration.stream.CharacterStreamWritingMessageConsumer;
@@ -110,9 +109,9 @@ public class ConsoleOutboundChannelAdapterParserTests {
beanCreationException = e;
}
Throwable parentCause = beanCreationException.getCause().getCause();
assertEquals(ConfigurationException.class, parentCause.getClass());
Throwable configurationExceptionCause = ((ConfigurationException) parentCause).getCause();
assertEquals(UnsupportedEncodingException.class, configurationExceptionCause.getClass());
assertEquals(IllegalArgumentException.class, parentCause.getClass());
Throwable rootCause = ((IllegalArgumentException) parentCause).getCause();
assertEquals(UnsupportedEncodingException.class, rootCause.getClass());
}
@Test