Avoid throws Exception where possible - Phase I

* Polishing - PR Comments
This commit is contained in:
Gary Russell
2019-03-07 12:53:52 -05:00
committed by Artem Bilan
parent 005bc80680
commit b187bca36e
130 changed files with 992 additions and 784 deletions

View File

@@ -204,7 +204,7 @@ public class FileTailInboundChannelAdapterFactoryBean extends AbstractFactoryBea
}
@Override
protected FileTailingMessageProducerSupport createInstance() throws Exception {
protected FileTailingMessageProducerSupport createInstance() {
FileTailingMessageProducerSupport adapter;
if (this.delay == null && this.end == null && this.reopen == null) {
adapter = new OSDelegatingFileTailingMessageProducer();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2019 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.file.transformer;
import java.io.File;
import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -107,8 +108,8 @@ public abstract class AbstractFilePayloadTransformer<T> implements Transformer,
*
* @param file The file.
* @return The result of the transformation.
* @throws Exception Any Exception.
* @throws IOException Any IOException.
*/
protected abstract T transformFile(File file) throws Exception;
protected abstract T transformFile(File file) throws IOException;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2019 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.file.transformer;
import java.io.File;
import java.io.IOException;
import org.springframework.util.FileCopyUtils;
@@ -28,7 +29,7 @@ import org.springframework.util.FileCopyUtils;
public class FileToByteArrayTransformer extends AbstractFilePayloadTransformer<byte[]> {
@Override
protected final byte[] transformFile(File file) throws Exception {
protected final byte[] transformFile(File file) throws IOException {
return FileCopyUtils.copyToByteArray(file);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.integration.file.transformer;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.Charset;
@@ -49,7 +50,7 @@ public class FileToStringTransformer extends AbstractFilePayloadTransformer<Stri
}
@Override
protected final String transformFile(File file) throws Exception {
protected final String transformFile(File file) throws IOException {
Reader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), this.charset));
return FileCopyUtils.copyToString(reader);
}

View File

@@ -368,7 +368,7 @@ public class FileOutboundChannelAdapterParserTests {
public static class FooAdvice extends AbstractRequestHandlerAdvice {
@Override
protected Object doInvoke(ExecutionCallback callback, Object target, Message<?> message) throws Exception {
protected Object doInvoke(ExecutionCallback callback, Object target, Message<?> message) {
adviceCalled++;
return callback.execute();
}