From: David ‘Bombe’ Roden Date: Thu, 19 Sep 2013 09:53:51 +0000 (+0200) Subject: Store and return copies of the raw bytes. X-Git-Tag: v2~272 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=5228d829b3db3f215eede30c658f3e0a1e721d5c;p=rhynodge.git Store and return copies of the raw bytes. --- diff --git a/src/main/java/net/pterodactylus/rhynodge/states/HttpState.java b/src/main/java/net/pterodactylus/rhynodge/states/HttpState.java index 95ea051..cdadd13 100644 --- a/src/main/java/net/pterodactylus/rhynodge/states/HttpState.java +++ b/src/main/java/net/pterodactylus/rhynodge/states/HttpState.java @@ -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); } /**