jainankitk commented on code in PR #17014:
URL: https://github.com/apache/lucene/pull/17014#discussion_r4608249641


##########
lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java:
##########
@@ -344,7 +344,10 @@ public void testCorruptSegmentInfoNamesTheSegment() throws 
Exception {
         } else {
           assertTrue(corruption + ": " + cause, cause instanceof IOException);
         }
-        assertTrue(corruption + ": " + cause, 
cause.toString().contains("_1.si"));
+
+        // NOTE: We can assert that the cause's message contains the filename 
once all relevant
+        // exception paths, including EOFException, provide it. For example: 
assertTrue(corruption +
+        // ": " + cause, cause.toString().contains("_1.si"));

Review Comment:
   I would rather add the check of exception message instead of removing the 
assertion altogether:
   
   ```
   -        assertTrue(corruption + ": " + cause, 
cause.toString().contains("_1.si"));
   +        // the file is named by this exception's message rather than the 
cause's: a truncated file
   +        // may surface as a bare EOFException (e.g. SimpleText codec on a 
ByteBuffersDirectory)
   +        assertTrue(corruption + ": " + e, e.getMessage().contains("_1.si"));
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to