From 5228d829b3db3f215eede30c658f3e0a1e721d5c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 19 Sep 2013 11:53:51 +0200 Subject: [PATCH] Store and return copies of the raw bytes. --- src/main/java/net/pterodactylus/rhynodge/states/HttpState.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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); } /** -- 2.7.4