This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit e10f5a8b5aed36249ca6b231e4186a1f6b6b34f1 Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Fri Jun 9 14:46:01 2023 +0200 (chores) core: remove declared exceptions which are never thrown The class is final and the exception is never thrown --- .../camel/converter/stream/FileInputStreamCache.java | 13 ++++--------- .../java/org/apache/camel/support/LazyStartProducer.java | 14 +++++++------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/core/camel-support/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java b/core/camel-support/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java index 3a308f6a477..dab0c36ad1c 100644 --- a/core/camel-support/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java +++ b/core/camel-support/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java @@ -19,7 +19,6 @@ package org.apache.camel.converter.stream; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -58,11 +57,11 @@ public final class FileInputStreamCache extends InputStream implements StreamCac private final CipherPair ciphers; /** Only for testing purposes. */ - public FileInputStreamCache(File file) throws FileNotFoundException { + public FileInputStreamCache(File file) { this(new TempFileManager(file, true)); } - FileInputStreamCache(TempFileManager closer) throws FileNotFoundException { + FileInputStreamCache(TempFileManager closer) { this.file = closer.getTempFile(); this.stream = null; this.ciphers = closer.getCiphers(); @@ -332,12 +331,8 @@ public final class FileInputStreamCache extends InputStream implements StreamCac return out; } - FileInputStreamCache newStreamCache() throws IOException { - try { - return new FileInputStreamCache(this); - } catch (FileNotFoundException e) { - throw new IOException("Cached file " + tempFile + " not found", e); - } + FileInputStreamCache newStreamCache() { + return new FileInputStreamCache(this); } void closeFileInputStreams() { diff --git a/core/camel-support/src/main/java/org/apache/camel/support/LazyStartProducer.java b/core/camel-support/src/main/java/org/apache/camel/support/LazyStartProducer.java index 3faee59942e..4d6b946e446 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/LazyStartProducer.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/LazyStartProducer.java @@ -70,37 +70,37 @@ public final class LazyStartProducer extends DefaultAsyncProducer implements Del } @Override - protected void doBuild() throws Exception { + protected void doBuild() { // noop as we dont want to start the delegate but its started on the first message processed } @Override - protected void doInit() throws Exception { + protected void doInit() { // noop as we dont want to start the delegate but its started on the first message processed } @Override - protected void doStart() throws Exception { + protected void doStart() { // noop as we dont want to start the delegate but its started on the first message processed } @Override - protected void doStop() throws Exception { + protected void doStop() { ServiceHelper.stopService(delegate); } @Override - protected void doSuspend() throws Exception { + protected void doSuspend() { ServiceHelper.suspendService(delegate); } @Override - protected void doResume() throws Exception { + protected void doResume() { ServiceHelper.resumeService(delegate); } @Override - protected void doShutdown() throws Exception { + protected void doShutdown() { ServiceHelper.stopAndShutdownService(delegate); }
