Skip to content

Commit aeccd8a

Browse files
rsafonsecayadvr
authored andcommitted
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
Signed-off-by: Rohit Yadav <[email protected]> This closes apache#394
1 parent 019f246 commit aeccd8a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ public boolean unassignAsa1000v(String tenantName, String firewallDn) throws Exe
12291229

12301230
private String sendRequest(String service, String xmlRequest) throws ExecutionException {
12311231
HttpClient client = new HttpClient();
1232-
byte[] response = null;
1232+
String response = null;
12331233
PostMethod method = new PostMethod("/xmlIM/" + service);
12341234
method.setRequestBody(xmlRequest);
12351235

@@ -1241,13 +1241,13 @@ private String sendRequest(String service, String xmlRequest) throws ExecutionEx
12411241
if (statusCode != HttpStatus.SC_OK) {
12421242
throw new Exception("Error code : " + statusCode);
12431243
}
1244-
response = method.getResponseBody();
1244+
response = method.getResponseBodyAsString();
12451245
} catch (Exception e) {
12461246
System.out.println(e.getMessage());
12471247
throw new ExecutionException(e.getMessage());
12481248
}
1249-
System.out.println(new String(response));
1250-
return new String(response);
1249+
System.out.println(response);
1250+
return response;
12511251
}
12521252

12531253
private Map<String, String> checkResponse(String xmlResponse, String... keys) throws ExecutionException {

0 commit comments

Comments
 (0)