This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git

commit 21bf71b49623db419b2e366b527f5edf44a3680e
Author: David Smiley <[email protected]>
AuthorDate: Wed Jun 3 00:24:37 2026 -0400

    JavaBinCodec: fix self-suppression risk (#4489)
    
    (cherry picked from commit ffd773b8dcb778407dd34aece4cab7322f85dd4b)
---
 solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java 
b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
index 7e4a96e50d9..da3dfcbe28f 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
@@ -1483,7 +1483,10 @@ public class JavaBinCodec implements PushWriter {
 
   @Override
   public void close() throws IOException {
-    if (daos != null) {
+    // marshal() already flushes in its own finally block, so skip the 
redundant flush.
+    // Flushing again after a marshal failure would re-throw the same 
exception from the broken
+    // stream, causing "Self-suppression not permitted" in the caller's 
try-with-resources.
+    if (daos != null && !alreadyMarshalled) {
       daos.flushBuffer();
     }
   }

Reply via email to