risdenk commented on code in PR #1153:
URL: https://github.com/apache/solr/pull/1153#discussion_r1009630226


##########
solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractIncrementalBackupTest.java:
##########
@@ -367,12 +367,14 @@ protected void corruptIndexFiles() throws IOException {
       if (indexFiles.isEmpty()) {
         return;
       }
-      fileToCorrupt = indexFiles.get(random().nextInt(indexFiles.size()) - 1);
+      fileToCorrupt = indexFiles.get(random().nextInt(indexFiles.size()));
     }
     final byte[] contents = Files.readAllBytes(fileToCorrupt);
     for (int i = 1; i < 5; i++) {
       int key = contents.length - CodecUtil.footerLength() - i;
-      contents[key] = (byte) (contents[key] + 1);
+      if (key >= 0) {

Review Comment:
   thats a good idea.



##########
solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractIncrementalBackupTest.java:
##########
@@ -367,12 +367,14 @@ protected void corruptIndexFiles() throws IOException {
       if (indexFiles.isEmpty()) {
         return;
       }
-      fileToCorrupt = indexFiles.get(random().nextInt(indexFiles.size()) - 1);
+      fileToCorrupt = indexFiles.get(random().nextInt(indexFiles.size()));

Review Comment:
   Ugh I swear nextInt was 1 -> some upperbound.
   
   https://docs.oracle.com/javase/8/docs/api/java/util/Random.html#nextInt-int-
   
   but I am 100% wrong there.



-- 
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