From 403ea49671a120d6a64d13134e141b6cd3ebca5b Mon Sep 17 00:00:00 2001 From: Sanjay Malakar Date: Sat, 7 Mar 2026 09:55:34 +0000 Subject: [PATCH] Fix CompositeInputStream.close() to close all streams on failure --- .../remoting/http12/CompositeInputStream.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/CompositeInputStream.java b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/CompositeInputStream.java index 53ba79cf523..3480f3b12d9 100644 --- a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/CompositeInputStream.java +++ b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/CompositeInputStream.java @@ -103,9 +103,21 @@ public int available() { @Override public void close() throws IOException { + IOException first = null; InputStream inputStream; while ((inputStream = inputStreams.poll()) != null) { - inputStream.close(); + try { + inputStream.close(); + } catch (IOException e) { + if (first == null) { + first = e; + } else { + first.addSuppressed(e); + } + } + } + if (first != null) { + throw first; } }