Fix EI_EXPOSE_REP family issue by copying.
Note: Variables which may be valid to be null uses ArrayUtils.clone()
Change-Id: I6a13dfd66753847de306d50bbdf32e724d896c56
diff --git a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZMultiEntryOperation.java b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZMultiEntryOperation.java
index d3df22c..99db3cc 100644
--- a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZMultiEntryOperation.java
+++ b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZMultiEntryOperation.java
@@ -4,8 +4,6 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
import net.onrc.onos.core.datastore.IKVTableID;
import net.onrc.onos.core.datastore.IMultiEntryOperation;
import net.onrc.onos.core.datastore.hazelcast.HZTable.VersionedValue;
@@ -35,11 +33,9 @@
* @param key
* @param operation
*/
- @SuppressFBWarnings(value = "EI_EXPOSE_REP2",
- justification = "TODO: Store a copy of the object?")
public HZMultiEntryOperation(final HZTable table, final byte[] key, final OPERATION operation) {
this.table = table;
- this.key = key;
+ this.key = key.clone();
this.status = STATUS.NOT_EXECUTED;
this.operation = operation;
@@ -56,11 +52,9 @@
* @param version
* @param operation
*/
- @SuppressFBWarnings(value = "EI_EXPOSE_REP2",
- justification = "TODO: Store a copy of the object?")
public HZMultiEntryOperation(final HZTable table, final byte[] key, final byte[] value, final long version, final OPERATION operation) {
this.table = table;
- this.key = key;
+ this.key = key.clone();
this.status = STATUS.NOT_EXECUTED;
this.operation = operation;
@@ -87,10 +81,8 @@
}
@Override
- @SuppressFBWarnings(value = "EI_EXPOSE_REP",
- justification = "TODO: Return a copy of the object?")
public byte[] getKey() {
- return key;
+ return key.clone();
}
@Override