You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/10/09 15:13:26 UTC

[GitHub] [commons-io] garydgregory commented on a diff in pull request #391: [IO-782] SequenceReader should close readers when its close method is called

garydgregory commented on code in PR #391:
URL: https://github.com/apache/commons-io/pull/391#discussion_r990801082


##########
src/main/java/org/apache/commons/io/input/SequenceReader.java:
##########
@@ -60,8 +65,26 @@ public SequenceReader(final Reader... readers) {
      */
     @Override
     public void close() throws IOException {
+        if (readersIterable == null) {
+            // already closed
+            return;
+        }
+
+        final List<IOException> ioExceptionList = new ArrayList<>();
+        for (Reader reader : readersIterable) {
+            try {
+                reader.close();
+            } catch (IOException e) {
+                ioExceptionList.add(e);

Review Comment:
   I'm not sure about the semantics here, which are completely different from `SequenceInputStream`. For good or bad, I think it would be better for the closing logic of this class to match `SequenceInputStream`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org