From 0f10831c05cb408d8670b662b08a8a5a76a05e63 Mon Sep 17 00:00:00 2001 From: Haeyoon Cho Date: Mon, 19 Aug 2019 13:36:58 +0900 Subject: [PATCH] [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 --- .../apache/nemo/runtime/executor/data/MemoryChunk.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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 fe914a6fa8..bbaa99a210 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 @@ public final void putDouble(final int index, final double value) { 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")