[NEMO-422] SonarCloud issues (#243)

JIRA: [NEMO-422: SonarCloud issues](https://issues.apache.org/jira/projects/NEMO/issues/NEMO-422)

**Major changes:**
- None

**Minor changes to note:**
- Minor fixes for SonarCloud

**Tests for the changes:**
- N/A

**Other comments:**
- None

Closes #243 
diff --git a/common/src/main/java/org/apache/nemo/common/coder/BytesDecoderFactory.java b/common/src/main/java/org/apache/nemo/common/coder/BytesDecoderFactory.java
index 847ad8f..6d5b232 100644
--- a/common/src/main/java/org/apache/nemo/common/coder/BytesDecoderFactory.java
+++ b/common/src/main/java/org/apache/nemo/common/coder/BytesDecoderFactory.java
@@ -18,9 +18,6 @@
  */
 package org.apache.nemo.common.coder;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.ByteArrayOutputStream;
 import java.io.EOFException;
 import java.io.IOException;
@@ -30,8 +27,6 @@
  * A {@link DecoderFactory} which is used for an array of bytes.
  */
 public final class BytesDecoderFactory implements DecoderFactory<byte[]> {
-  private static final Logger LOG = LoggerFactory.getLogger(BytesDecoderFactory.class.getName());
-
   private static final BytesDecoderFactory BYTES_DECODER_FACTORY = new BytesDecoderFactory();
 
   /**
diff --git a/common/src/main/java/org/apache/nemo/common/coder/BytesEncoderFactory.java b/common/src/main/java/org/apache/nemo/common/coder/BytesEncoderFactory.java
index afe1623..03f3694 100644
--- a/common/src/main/java/org/apache/nemo/common/coder/BytesEncoderFactory.java
+++ b/common/src/main/java/org/apache/nemo/common/coder/BytesEncoderFactory.java
@@ -18,9 +18,6 @@
  */
 package org.apache.nemo.common.coder;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.IOException;
 import java.io.OutputStream;
 
@@ -28,8 +25,6 @@
  * A {@link EncoderFactory} which is used for an array of bytes.
  */
 public final class BytesEncoderFactory implements EncoderFactory<byte[]> {
-  private static final Logger LOG = LoggerFactory.getLogger(BytesEncoderFactory.class.getName());
-
   private static final BytesEncoderFactory BYTES_ENCODER_FACTORY = new BytesEncoderFactory();
 
   /**
diff --git a/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/DirectByteBufferOutputStream.java b/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/DirectByteBufferOutputStream.java
index dae3859..0e4010f 100644
--- a/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/DirectByteBufferOutputStream.java
+++ b/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/DirectByteBufferOutputStream.java
@@ -135,8 +135,7 @@
   @VisibleForTesting
   byte[] toByteArray() {
     if (dataList.isEmpty()) {
-      final byte[] byteArray = new byte[0];
-      return byteArray;
+      return new byte[0];
     }
     MemoryChunk lastBuf = dataList.getLast();
     // pageSize equals the size of the data filled in the ByteBuffers
@@ -191,6 +190,8 @@
   /**
    * Closing this output stream has no effect.
    */
+  @Override
   public void close() {
+    // do nothing
   }
 }
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 e5d9803..8e786ef 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
@@ -43,6 +43,7 @@
   private static final int CHAR_SIZE = 2;
   private static final int INT_SIZE = 4;
   private static final int LONG_SIZE = 8;
+  private static final String CHUNK_FREED = "MemoryChunk has been freed";
   private final ByteBuffer buffer;
   // Since using UNSAFE does not automatically track the address and limit, it should be accessed
   // through address for data write and get, and addressLimit for sanity checks on the buffer use.
@@ -87,7 +88,7 @@
    */
   public ByteBuffer getBuffer() {
     if (address > addressLimit) {
-      throw new IllegalStateException("MemoryChunk has been freed");
+      throw new IllegalStateException(CHUNK_FREED);
     }
     return buffer;
   }
@@ -121,7 +122,7 @@
     if (checkIndex(index, pos, BYTE_SIZE)) {
       return UNSAFE.getByte(pos);
     } else if (address > addressLimit) {
-      throw new IllegalStateException("MemoryChunk has been freed");
+      throw new IllegalStateException(CHUNK_FREED);
     } else {
       throw new IndexOutOfBoundsException();
     }
@@ -139,7 +140,7 @@
     if (checkIndex(index, pos, BYTE_SIZE)) {
       UNSAFE.putByte(pos, b);
     } else if (address > addressLimit) {
-      throw new IllegalStateException("MemoryChunk has been freed");
+      throw new IllegalStateException(CHUNK_FREED);
     } else {
       throw new IndexOutOfBoundsException();
     }
@@ -184,7 +185,7 @@
       final long arrayAddress = BYTE_ARRAY_BASE_OFFSET + offset;
       UNSAFE.copyMemory(null, pos, dst, arrayAddress, length);
     } else if (address > addressLimit) {
-      throw new IllegalStateException("MemoryChunk has been freed");
+      throw new IllegalStateException(CHUNK_FREED);
     } else {
       throw new IndexOutOfBoundsException();
     }
@@ -208,7 +209,7 @@
       final long arrayAddress = BYTE_ARRAY_BASE_OFFSET + offset;
       UNSAFE.copyMemory(src, arrayAddress, null, pos, length);
     } else if (address > addressLimit) {
-      throw new IllegalStateException("MemoryChunk has been freed");
+      throw new IllegalStateException(CHUNK_FREED);
     } else {
       throw new IndexOutOfBoundsException();
     }
@@ -232,7 +233,7 @@
         return Character.reverseBytes(UNSAFE.getChar(pos));
       }
     } else if (address > addressLimit) {
-      throw new IllegalStateException("This MemoryChunk has been freed.");
+      throw new IllegalStateException(CHUNK_FREED);
     } else {
       throw new IndexOutOfBoundsException();
     }
@@ -256,7 +257,7 @@
         UNSAFE.putChar(pos, Character.reverseBytes(value));
       }
     } else if (address > addressLimit) {
-      throw new IllegalStateException("MemoryChunk has been freed");
+      throw new IllegalStateException(CHUNK_FREED);
     } else {
       throw new IndexOutOfBoundsException();
     }
@@ -281,7 +282,7 @@
         return Short.reverseBytes(UNSAFE.getShort(pos));
       }
     } else if (address > addressLimit) {
-      throw new IllegalStateException("MemoryChunk has been freed");
+      throw new IllegalStateException(CHUNK_FREED);
     } else {
       throw new IndexOutOfBoundsException();
     }
@@ -306,7 +307,7 @@
         UNSAFE.putShort(pos, Short.reverseBytes(value));
       }
     } else if (address > addressLimit) {
-      throw new IllegalStateException("MemoryChunk has been freed");
+      throw new IllegalStateException(CHUNK_FREED);
     } else {
       throw new IndexOutOfBoundsException();
     }
@@ -329,7 +330,7 @@
         return Integer.reverseBytes(UNSAFE.getInt(pos));
       }
     } else if (address > addressLimit) {
-      throw new IllegalStateException("MemoryChunk has been freed");
+      throw new IllegalStateException(CHUNK_FREED);
     } else {
       throw new IndexOutOfBoundsException();
     }
@@ -352,7 +353,7 @@
         UNSAFE.putInt(pos, Integer.reverseBytes(value));
       }
     } else if (address > addressLimit) {
-      throw new IllegalStateException("MemoryChunk has been freed");
+      throw new IllegalStateException(CHUNK_FREED);
     } else {
       throw new IndexOutOfBoundsException();
     }
@@ -375,7 +376,7 @@
         return Long.reverseBytes(UNSAFE.getLong(pos));
       }
     } else if (address > addressLimit) {
-      throw new IllegalStateException("MemoryChunk has been freed");
+      throw new IllegalStateException(CHUNK_FREED);
     } else {
       throw new IndexOutOfBoundsException();
     }
@@ -398,7 +399,7 @@
         UNSAFE.putLong(pos, Long.reverseBytes(value));
       }
     } else if (address > addressLimit) {
-      throw new IllegalStateException("MemoryChunk has been freed");
+      throw new IllegalStateException(CHUNK_FREED);
     } else {
       throw new IndexOutOfBoundsException();
     }
diff --git a/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/MemoryPoolAssigner.java b/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/MemoryPoolAssigner.java
index 02af48a..199072b 100644
--- a/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/MemoryPoolAssigner.java
+++ b/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/MemoryPoolAssigner.java
@@ -20,8 +20,6 @@
 
 import net.jcip.annotations.ThreadSafe;
 import org.apache.reef.tang.annotations.Parameter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.nemo.conf.JobConf;
 
 import javax.inject.Inject;
@@ -42,9 +40,6 @@
  */
 @ThreadSafe
 public class MemoryPoolAssigner {
-
-  private static final Logger LOG = LoggerFactory.getLogger(MemoryPoolAssigner.class.getName());
-
   private final int chunkSize;
 
   private static final int MIN_CHUNK_SIZE_KB = 4;
diff --git a/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/partition/SerializedPartition.java b/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/partition/SerializedPartition.java
index 2606c50..53e9d36 100644
--- a/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/partition/SerializedPartition.java
+++ b/runtime/executor/src/main/java/org/apache/nemo/runtime/executor/data/partition/SerializedPartition.java
@@ -24,8 +24,6 @@
 import org.apache.nemo.runtime.executor.data.MemoryPoolAssigner;
 import org.apache.nemo.common.coder.EncoderFactory;
 import org.apache.nemo.runtime.executor.data.streamchainer.Serializer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.annotation.Nullable;
 import java.io.IOException;
@@ -45,8 +43,6 @@
  * @param <K> the key type of its partitions.
  */
 public final class SerializedPartition<K> implements Partition<byte[], K> {
-  private static final Logger LOG = LoggerFactory.getLogger(SerializedPartition.class.getName());
-
   private final K key;
   private volatile byte[] serializedData; // intentionally volatilize the reference
   private volatile int length;
@@ -59,7 +55,7 @@
   @Nullable
   private final EncoderFactory.Encoder encoder;
   private final MemoryPoolAssigner memoryPoolAssigner;
-  private volatile List<MemoryChunk> dataList;
+  private volatile List<MemoryChunk> dataList; // intentionally set to volatile to prevent null reference
   private final boolean offheap;
 
   /**