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/MacAddress.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/MacAddress.java
index 27d5b66..48a4faf 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/MacAddress.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/MacAddress.java
@@ -79,7 +79,7 @@
return MacAddress.of(raw);
}
- volatile byte[] bytesCache = null;
+ private volatile byte[] bytesCache = null;
public byte[] getBytes() {
if (bytesCache == null) {
@@ -95,7 +95,7 @@
}
}
}
- return bytesCache;
+ return bytesCache.clone();
}
/**