diff --git a/core/src/main/java/org/apache/druid/data/input/Firehose.java b/core/src/main/java/org/apache/druid/data/input/Firehose.java index f2951dfe591..a1af12fb6d7 100644 --- a/core/src/main/java/org/apache/druid/data/input/Firehose.java +++ b/core/src/main/java/org/apache/druid/data/input/Firehose.java @@ -56,7 +56,7 @@ public interface Firehose extends Closeable * * @return true if and when there is another row available, false if the stream has dried up */ - boolean hasMore(); + boolean hasMore() throws IOException; /** * The next row available. Should only be called if hasMore returns true. @@ -65,7 +65,7 @@ public interface Firehose extends Closeable * @return The next row */ @Nullable - InputRow nextRow(); + InputRow nextRow() throws IOException; /** * Returns an InputRowPlusRaw object containing the InputRow plus the raw, unparsed data corresponding to the next row @@ -75,7 +75,7 @@ public interface Firehose extends Closeable * * @return an InputRowPlusRaw which may contain any of: an InputRow, the raw data, or a ParseException */ - default InputRowPlusRaw nextRowWithRaw() + default InputRowPlusRaw nextRowWithRaw() throws IOException { try { return InputRowPlusRaw.of(nextRow(), null); diff --git a/core/src/main/java/org/apache/druid/data/input/impl/FileIteratingFirehose.java b/core/src/main/java/org/apache/druid/data/input/impl/FileIteratingFirehose.java index 23224fb2fa3..2c2963c8c68 100644 --- a/core/src/main/java/org/apache/druid/data/input/impl/FileIteratingFirehose.java +++ b/core/src/main/java/org/apache/druid/data/input/impl/FileIteratingFirehose.java @@ -62,7 +62,7 @@ public class FileIteratingFirehose implements Firehose } @Override - public boolean hasMore() + public boolean hasMore() throws IOException { while ((lineIterator == null || !lineIterator.hasNext()) && lineIterators.hasNext()) { lineIterator = getNextLineIterator(); @@ -73,7 +73,7 @@ public class FileIteratingFirehose implements Firehose @Nullable @Override - public InputRow nextRow() + public InputRow nextRow() throws IOException { if (!hasMore()) { throw new NoSuchElementException(); @@ -83,7 +83,7 @@ public class FileIteratingFirehose implements Firehose } @Override - public InputRowPlusRaw nextRowWithRaw() + public InputRowPlusRaw nextRowWithRaw() throws IOException { if (!hasMore()) { throw new NoSuchElementException(); @@ -98,7 +98,7 @@ public class FileIteratingFirehose implements Firehose } } - private LineIterator getNextLineIterator() + private LineIterator getNextLineIterator() throws IOException { if (lineIterator != null) { lineIterator.close(); @@ -119,7 +119,7 @@ public class FileIteratingFirehose implements Firehose public void close() throws IOException { try (Closeable ignore = closer; - Closeable ignore2 = lineIterator != null ? lineIterator::close : null) { + Closeable ignore2 = lineIterator) { // close both via try-with-resources } } diff --git a/licenses.yaml b/licenses.yaml index 48c0deeb33f..a39f2eeedce 100644 --- a/licenses.yaml +++ b/licenses.yaml @@ -336,7 +336,7 @@ name: Apache Commons IO license_category: binary module: java-core license_name: Apache License version 2.0 -version: 2.5 +version: 2.6 libraries: - commons-io: commons-io diff --git a/pom.xml b/pom.xml index 149c2c1dd48..e2453165621 100644 --- a/pom.xml +++ b/pom.xml @@ -206,7 +206,7 @@ commons-io commons-io - 2.5 + 2.6 commons-logging diff --git a/server/src/main/java/org/apache/druid/segment/realtime/firehose/CombiningFirehoseFactory.java b/server/src/main/java/org/apache/druid/segment/realtime/firehose/CombiningFirehoseFactory.java index 1602d579143..1b7931bd16b 100644 --- a/server/src/main/java/org/apache/druid/segment/realtime/firehose/CombiningFirehoseFactory.java +++ b/server/src/main/java/org/apache/druid/segment/realtime/firehose/CombiningFirehoseFactory.java @@ -105,14 +105,14 @@ public class CombiningFirehoseFactory implements FirehoseFactory } @Override - public boolean hasMore() + public boolean hasMore() throws IOException { return currentFirehose.hasMore(); } @Nullable @Override - public InputRow nextRow() + public InputRow nextRow() throws IOException { InputRow rv = currentFirehose.nextRow(); if (!currentFirehose.hasMore()) { diff --git a/server/src/main/java/org/apache/druid/segment/realtime/firehose/FixedCountFirehoseFactory.java b/server/src/main/java/org/apache/druid/segment/realtime/firehose/FixedCountFirehoseFactory.java index e8a7dca1a8a..14b9ed3b001 100644 --- a/server/src/main/java/org/apache/druid/segment/realtime/firehose/FixedCountFirehoseFactory.java +++ b/server/src/main/java/org/apache/druid/segment/realtime/firehose/FixedCountFirehoseFactory.java @@ -67,17 +67,17 @@ public class FixedCountFirehoseFactory implements FirehoseFactory return new Firehose() { private int i = 0; - private Firehose delegateFirehose = delegate.connect(parser, temporaryDirectory); + private final Firehose delegateFirehose = delegate.connect(parser, temporaryDirectory); @Override - public boolean hasMore() + public boolean hasMore() throws IOException { return i < count && delegateFirehose.hasMore(); } @Nullable @Override - public InputRow nextRow() + public InputRow nextRow() throws IOException { Preconditions.checkArgument(i++ < count, "Max events limit reached."); return delegateFirehose.nextRow(); diff --git a/server/src/main/java/org/apache/druid/segment/realtime/firehose/PredicateFirehose.java b/server/src/main/java/org/apache/druid/segment/realtime/firehose/PredicateFirehose.java index 446efa3ed1b..aaecc022638 100644 --- a/server/src/main/java/org/apache/druid/segment/realtime/firehose/PredicateFirehose.java +++ b/server/src/main/java/org/apache/druid/segment/realtime/firehose/PredicateFirehose.java @@ -50,7 +50,7 @@ public class PredicateFirehose implements Firehose } @Override - public boolean hasMore() + public boolean hasMore() throws IOException { if (savedInputRow != null) { return true; diff --git a/server/src/main/java/org/apache/druid/segment/realtime/firehose/TimedShutoffFirehoseFactory.java b/server/src/main/java/org/apache/druid/segment/realtime/firehose/TimedShutoffFirehoseFactory.java index 2ace21cb0a1..3a636cebf99 100644 --- a/server/src/main/java/org/apache/druid/segment/realtime/firehose/TimedShutoffFirehoseFactory.java +++ b/server/src/main/java/org/apache/druid/segment/realtime/firehose/TimedShutoffFirehoseFactory.java @@ -107,20 +107,20 @@ public class TimedShutoffFirehoseFactory implements FirehoseFactory