Fix ConcatReader.close() to close all readers on failure

This commit is contained in:
Sanjay Malakar committed 2026-03-09 07:59:33 +00:00
1 parent 1ccdca549c
commit 6474f912a4
2 files changed
+16 -2

No files matched your search

@@ -383,10 +383,17 @@ public class ConcatReader extends Reader {
@Override
public void close() throws IOException {
if (closed) return;
IOException first = null;
for (Reader reader : readerQueue) {
reader.close();
try {
reader.close();
} catch (IOException e) {
if (first == null) first = e;
else first.addSuppressed(e);
}
}
closed = true;
if (first != null) throw first;
}
/**
@@ -381,10 +381,17 @@ public class ConcatReader extends Reader {
@Override
public void close() throws IOException {
if (closed) return;
IOException first = null;
for (Reader reader : readerQueue) {
reader.close();
try {
reader.close();
} catch (IOException e) {
if (first == null) first = e;
else first.addSuppressed(e);
}
}
closed = true;
if (first != null) throw first;
}
/**