Skip to content

Commit 949e97d

Browse files
rsafonsecayadvr
authored andcommitted
Fix findbugs warning in LibvirtConsoleProxyLoadCommandWrapper Encoding is now specified in both server and clients for the console proxy getstatus command For some reason, findbugs did not detect unsafe encoding issue in ConsoleProxyResource.java, is properly specified now though... CitrixConsoleProxyLoadCommandWrapper was specifying system default encoding for operation, should be ok because default for xenserver is UTF-8 since it's linux based, but it's best to specify exact encoding set on the server end to be consistent
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 509c83b commit 949e97d

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, fin
149149
final URLConnection conn = url.openConnection();
150150

151151
final InputStream is = conn.getInputStream();
152-
final BufferedReader reader = new BufferedReader(new InputStreamReader(is));
152+
final BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
153153
final StringBuilder sb2 = new StringBuilder();
154154
String line = null;
155155
try {

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtConsoleProxyLoadCommandWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, fina
5050
final URLConnection conn = url.openConnection();
5151

5252
final InputStream is = conn.getInputStream();
53-
final BufferedReader reader = new BufferedReader(new InputStreamReader(is));
53+
final BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
5454
final StringBuilder sb2 = new StringBuilder();
5555
String line = null;
5656
try {
@@ -75,4 +75,4 @@ public Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, fina
7575

7676
return new ConsoleProxyLoadAnswer(cmd, proxyVmId, proxyVmName, success, result);
7777
}
78-
}
78+
}

plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixConsoleProxyLoadCommandWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, f
5555
conn.setReadTimeout(5000);
5656

5757
final InputStream is = conn.getInputStream();
58-
final BufferedReader reader = new BufferedReader(new InputStreamReader(is, Charset.defaultCharset()));
58+
final BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
5959
final StringBuilder sb2 = new StringBuilder();
6060
String line = null;
6161
try {
@@ -80,4 +80,4 @@ protected Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, f
8080

8181
return new ConsoleProxyLoadAnswer(cmd, proxyVmId, proxyVmName, success, result);
8282
}
83-
}
83+
}

services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyCmdHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void doHandle(HttpExchange t) throws Exception {
6363
Headers hds = t.getResponseHeaders();
6464
hds.set("Content-Type", "text/plain");
6565
t.sendResponseHeaders(200, 0);
66-
OutputStreamWriter os = new OutputStreamWriter(t.getResponseBody());
66+
OutputStreamWriter os = new OutputStreamWriter(t.getResponseBody(),"UTF-8");
6767
statsCollector.getStatsReport(os);
6868
os.close();
6969
}

0 commit comments

Comments
 (0)