http-client-branch: fix mutable byte[] references http-client-branch
authorchegar
Mon, 05 Feb 2018 11:36:11 +0000
branchhttp-client-branch
changeset 56059 f5473559b6d3
parent 56058 a02d0098c630
child 56060 f09e8e9bbdd2
http-client-branch: fix mutable byte[] references
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/frame/GoAwayFrame.java
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/frame/PingFrame.java
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/frame/GoAwayFrame.java	Thu Feb 01 15:37:38 2018 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/frame/GoAwayFrame.java	Mon Feb 05 11:36:11 2018 +0000
@@ -40,7 +40,7 @@
     public GoAwayFrame(int lastStream, int errorCode, byte[] debugData) {
         super(0, 0, errorCode);
         this.lastStream = lastStream;
-        this.debugData = debugData;
+        this.debugData = debugData.clone();
     }
 
     @Override
@@ -63,7 +63,7 @@
     }
 
     public byte[] getDebugData() {
-        return debugData;
+        return debugData.clone();
     }
 
 }
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/frame/PingFrame.java	Thu Feb 01 15:37:38 2018 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/frame/PingFrame.java	Mon Feb 05 11:36:11 2018 +0000
@@ -38,7 +38,7 @@
     public PingFrame(int flags, byte[] data) {
         super(0, flags);
         assert data.length == 8;
-        this.data = data;
+        this.data = data.clone();
     }
 
     @Override
@@ -61,7 +61,7 @@
     }
 
     public byte[] getData() {
-        return data;
+        return data.clone();
     }
 
 }