--- old/src/java.base/share/classes/java/io/SequenceInputStream.java 2019-07-26 11:59:38.000000000 -0700 +++ new/src/java.base/share/classes/java/io/SequenceInputStream.java 2019-07-26 11:59:38.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -88,7 +88,7 @@ } /** - * Continues reading in the next stream if an EOF is reached. + * Continues reading in the next stream if an EOF is reached. */ final void nextStream() throws IOException { if (in != null) { @@ -220,8 +220,21 @@ * @exception IOException if an I/O error occurs. */ public void close() throws IOException { - do { - nextStream(); - } while (in != null); + IOException ioe = null; + while (in != null) { + try { + in.close(); + } catch (IOException e) { + if (ioe == null) { + ioe = e; + } else { + ioe.addSuppressed(e); + } + } + peekNextStream(); + } + if (ioe != null) { + throw ioe; + } } }