From 315b75e4ff9d324cde8c4156796ef9e382f60369 Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Fri, 12 Jun 2015 22:07:20 +0200 Subject: [PATCH] Fix findbugs encoding issue This is done by calling HttpMethodBase's getResponseBodyAsString() which properly lookup the specified encoding in the request's Content-Type header This also avoids instantiation of two extra strings on the println() and return statements --- .../com/cloud/network/cisco/CiscoVnmcConnectionImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java index 0057e2e4da24..6481a28a3a00 100644 --- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java +++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java @@ -1229,7 +1229,7 @@ public boolean unassignAsa1000v(String tenantName, String firewallDn) throws Exe private String sendRequest(String service, String xmlRequest) throws ExecutionException { HttpClient client = new HttpClient(); - byte[] response = null; + String response = null; PostMethod method = new PostMethod("/xmlIM/" + service); method.setRequestBody(xmlRequest); @@ -1241,13 +1241,13 @@ private String sendRequest(String service, String xmlRequest) throws ExecutionEx if (statusCode != HttpStatus.SC_OK) { throw new Exception("Error code : " + statusCode); } - response = method.getResponseBody(); + response = method.getResponseBodyAsString(); } catch (Exception e) { System.out.println(e.getMessage()); throw new ExecutionException(e.getMessage()); } - System.out.println(new String(response)); - return new String(response); + System.out.println(response); + return response; } private Map checkResponse(String xmlResponse, String... keys) throws ExecutionException {