Store and return copies of the raw bytes.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 19 Sep 2013 09:53:51 +0000 (11:53 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 19 Sep 2013 09:55:20 +0000 (11:55 +0200)
src/main/java/net/pterodactylus/rhynodge/states/HttpState.java

index 95ea051..cdadd13 100644 (file)
@@ -17,6 +17,8 @@
 
 package net.pterodactylus.rhynodge.states;
 
+import static java.util.Arrays.copyOf;
+
 import java.io.UnsupportedEncodingException;
 
 import net.pterodactylus.rhynodge.State;
@@ -61,7 +63,7 @@ public class HttpState extends AbstractState {
                this.uri = uri;
                this.protocolCode = protocolCode;
                this.contentType = contentType;
-               this.rawResult = rawResult;
+               this.rawResult = copyOf(rawResult, rawResult.length);
        }
 
        //
@@ -101,7 +103,7 @@ public class HttpState extends AbstractState {
         * @return The raw result of the reply
         */
        public byte[] rawResult() {
-               return rawResult;
+               return copyOf(rawResult, rawResult.length);
        }
 
        /**