Fix some of the suppressed FindBugs warnings: EI_EXPOSE_REP and EI_EXPOSE_REP2

The fix is to copy the data when setting/returning it.
If this becomes a bottleneck, we can revisit the solution.


Change-Id: I7ad345aa8d19a41221b3550dd9d2cfcd08b36fd1
diff --git a/src/main/java/net/onrc/onos/core/packet/LLDPTLV.java b/src/main/java/net/onrc/onos/core/packet/LLDPTLV.java
index 7acef72..8de0d8a 100644
--- a/src/main/java/net/onrc/onos/core/packet/LLDPTLV.java
+++ b/src/main/java/net/onrc/onos/core/packet/LLDPTLV.java
@@ -20,8 +20,6 @@
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
 /**
  * @author David Erickson (daviderickson@cs.stanford.edu)
  */
@@ -63,19 +61,22 @@
     /**
      * @return the value
      */
-    @SuppressFBWarnings(value = "EI_EXPOSE_REP",
-                        justification = "TODO: Return a copy of the object?")
     public byte[] getValue() {
-        return value;
+        if (this.value == null) {
+            return null;
+        }
+        return this.value.clone();
     }
 
     /**
      * @param value the value to set
      */
-    @SuppressFBWarnings(value = "EI_EXPOSE_REP2",
-                        justification = "TODO: Store a copy of the object?")
     public LLDPTLV setValue(byte[] value) {
-        this.value = value;
+        if (value == null) {
+            this.value = null;
+        } else {
+            this.value = value.clone();
+        }
         return this;
     }