You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nemo.apache.org by gw...@apache.org on 2019/08/19 04:37:02 UTC

[incubator-nemo] branch master updated: [NEMO-412] Address Sonar Cloud issue for MemoryChunk (#233)

This is an automated email from the ASF dual-hosted git repository.

gwlee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nemo.git


The following commit(s) were added to refs/heads/master by this push:
     new c238040  [NEMO-412] Address Sonar Cloud issue for MemoryChunk (#233)
c238040 is described below

commit c23804089c54ef3bdf2443d8db3dcf0c5487a675
Author: Haeyoon Cho <ch...@gmail.com>
AuthorDate: Mon Aug 19 13:36:58 2019 +0900

    [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
---
 .../java/org/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 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 @@ public class MemoryChunk {
     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")