thecoop commented on code in PR #14633:
URL: https://github.com/apache/lucene/pull/14633#discussion_r2081616824


##########
lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene101/Lucene101PostingsReader.java:
##########
@@ -120,23 +119,21 @@ public Lucene101PostingsReader(SegmentReadState state) 
throws IOException {
         expectedPayFileLength = -1;
       }
       CodecUtil.checkFooter(metaIn, null);
-      success = true;
     } catch (Throwable t) {
-      if (metaIn != null) {
-        CodecUtil.checkFooter(metaIn, t);
-        throw new AssertionError("unreachable");
-      } else {
-        throw t;
-      }
-    } finally {
-      if (success) {
-        metaIn.close();
-      } else {
-        IOUtils.closeWhileHandlingException(metaIn);
+      try {
+        if (metaIn != null) {
+          CodecUtil.checkFooter(metaIn, t);
+          throw new AssertionError("unreachable");
+        } else {
+          throw t;
+        }
+      } catch (Throwable ct) {
+        IOUtils.closeWhileSuppressingExceptions(ct, metaIn);
+        throw ct;
       }
     }
+    metaIn.close();

Review Comment:
   Yes - needs some tweaks to the try structures...



-- 
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-unsubscr...@lucene.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to