You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/10/23 10:17:12 UTC

[GitHub] [hadoop] steveloughran commented on a diff in pull request #5065: HADOOP-18505. Handled ArrayIndexOutOfBoundsException in TestCoderBase

steveloughran commented on code in PR #5065:
URL: https://github.com/apache/hadoop/pull/5065#discussion_r1002684035


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/DecodingState.java:
##########
@@ -39,7 +39,7 @@ <T> void checkParameters(T[] inputs, int[] erasedIndexes,
                            T[] outputs) {
     if (inputs.length != decoder.getNumParityUnits() +
         decoder.getNumDataUnits()) {
-      throw new IllegalArgumentException("Invalid inputs length");
+      throw new HadoopIllegalArgumentException("Invalid inputs length");

Review Comment:
   implicit changes in public api; revert



##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/rawcoder/TestDecodingValidator.java:
##########
@@ -123,7 +125,12 @@ protected void performTestValidate(int chunkSize) {
     }
 
     // decode
-    backupAndEraseChunks(clonedDataChunks, parityChunks);
+    try {

Review Comment:
   use LambdaTestUtils.intercept() for *all* bits of test code which validates expected exceptions



##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/TestCoderBase.java:
##########
@@ -224,13 +225,25 @@ protected ECChunk[] backupAndEraseChunks(ECChunk[] dataChunks,
     int idx = 0;
 
     for (int i = 0; i < erasedDataIndexes.length; i++) {
-      toEraseChunks[idx ++] = dataChunks[erasedDataIndexes[i]];
-      dataChunks[erasedDataIndexes[i]] = null;
+      if (erasedDataIndexes[i] < dataChunks.length) {
+        toEraseChunks[idx ++] = dataChunks[erasedDataIndexes[i]];
+        dataChunks[erasedDataIndexes[i]] = null;
+      } else {
+        throw new HadoopIllegalArgumentException(

Review Comment:
   ditto



##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/rawcoder/TestDecodingValidator.java:
##########
@@ -210,7 +217,12 @@ public void testValidateWithBadDecoding() throws IOException {
     }
 
     // decode
-    backupAndEraseChunks(clonedDataChunks, parityChunks);
+    try {

Review Comment:
   ditto



-- 
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: common-issues-unsubscribe@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org