aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSORESTClient/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSORESTClient/src/main/java')
-rw-r--r--bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java16
-rw-r--r--bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java8
2 files changed, 9 insertions, 15 deletions
diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java
index dfb9f36e9a..ea9ca62bf5 100644
--- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java
+++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java
@@ -21,6 +21,7 @@
package org.openecomp.mso.rest;
import java.io.IOException;
+import java.util.Arrays;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
@@ -44,7 +45,7 @@ public class APIResponse {
* @param httpResponse used to create headers
* @return http headers
*/
- private HttpHeader[] buildHeaders(final HttpResponse httpResponse) {
+ private static HttpHeader[] buildHeaders(final HttpResponse httpResponse) {
final Header[] headers = httpResponse.getAllHeaders();
HttpHeader[] httpHeaders = new HttpHeader[headers.length];
@@ -102,7 +103,12 @@ public class APIResponse {
* @return http response body
*/
public byte[] getResponseBodyAsByteArray() {
- return this.responseBody;
+ // avoid exposing internals, create copy
+ if (this.responseBody != null) {
+ return Arrays.copyOf(this.responseBody, this.responseBody.length);
+ } else {
+ return null;
+ }
}
/**
@@ -125,11 +131,7 @@ public class APIResponse {
*/
public HttpHeader[] getAllHeaders() {
// avoid exposing internals, create copy
- HttpHeader[] copy = new HttpHeader[this.headers.length];
- for (int i = 0; i < this.headers.length; ++i) {
- copy[i] = headers[i];
- }
- return copy;
+ return Arrays.copyOf(this.headers, this.headers.length);
}
public String getFirstHeader(String name) {
diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java
index 5c200046ca..cab3e5082e 100644
--- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java
+++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java
@@ -91,7 +91,6 @@ public class RESTClient {
private final LinkedHashMap<String, List<String>> parameters;
private HttpEntity httpEntity;
- private HttpClient unitTestClient;
/**
* Internal method used to build an APIResponse using the specified
@@ -583,13 +582,6 @@ public class RESTClient {
return httpEntity;
}
- public HttpClient getUnitTestClient() {
- return unitTestClient;
- }
-
- public void setUnitTestClient(HttpClient unitTestClient) {
- this.unitTestClient = unitTestClient;
- }
/**
* Allows inclusion of a request body with DELETE.