java_gen: Return copies of byte arrays in getBytes LOXI-58
The getBytes() methods of various classes in openflow.types were
returning and caching instances of byte[], which is mutable. They
now return clone()'d instances.
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java
index 8337eb6..86633a5 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java
@@ -67,7 +67,7 @@
return LENGTH;
}
- volatile byte[] bytesCache = null;
+ private volatile byte[] bytesCache = null;
public byte[] getBytes() {
if (bytesCache == null) {
@@ -79,7 +79,7 @@
}
}
}
- return bytesCache;
+ return bytesCache.clone();
}
public void write2Bytes(ChannelBuffer c) {