[NEMO-412] Address Sonar Cloud issue for MemoryChunk (#233)
JIRA: [NEMO-412: Address Sonar Cloud issue for MemoryChunk](https://issues.apache.org/jira/projects/NEMO/issues/NEMO-412)
**Major changes:**
- `checkIndex()` in `MemoryChunk` is fixed to return either true or false.
**Minor changes to note:**
- None
Closes #233
diff --git a/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/MemoryChunk.java b/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/MemoryChunk.java
index fe914a6..bbaa99a 100644
--- a/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/MemoryChunk.java
+++ b/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/MemoryChunk.java
@@ -451,12 +451,8 @@
putLong(index, Double.doubleToRawLongBits(value));
}
- private boolean checkIndex(final int index, final long pos, final int typeSize) throws IndexOutOfBoundsException {
- if (!(index >= 0 && pos <= addressLimit - typeSize)) {
- throw new IndexOutOfBoundsException();
- } else {
- return true;
- }
+ private boolean checkIndex(final int index, final long pos, final int typeSize) {
+ return (index >= 0 && pos <= (addressLimit - typeSize));
}
@SuppressWarnings("restriction")