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>
This commit is contained in:
Rafael da Fonseca 2015-06-13 01:46:26 +02:00 committed by Rohit Yadav
parent 509c83bc74
commit 949e97dec6
4 changed files with 6 additions and 6 deletions

View File

@ -149,7 +149,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
final URLConnection conn = url.openConnection();
final InputStream is = conn.getInputStream();
final BufferedReader reader = new BufferedReader(new InputStreamReader(is));
final BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
final StringBuilder sb2 = new StringBuilder();
String line = null;
try {

View File

@ -50,7 +50,7 @@ public abstract class LibvirtConsoleProxyLoadCommandWrapper<T extends Command, A
final URLConnection conn = url.openConnection();
final InputStream is = conn.getInputStream();
final BufferedReader reader = new BufferedReader(new InputStreamReader(is));
final BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
final StringBuilder sb2 = new StringBuilder();
String line = null;
try {
@ -75,4 +75,4 @@ public abstract class LibvirtConsoleProxyLoadCommandWrapper<T extends Command, A
return new ConsoleProxyLoadAnswer(cmd, proxyVmId, proxyVmName, success, result);
}
}
}

View File

@ -55,7 +55,7 @@ public abstract class CitrixConsoleProxyLoadCommandWrapper<T extends Command, A
conn.setReadTimeout(5000);
final InputStream is = conn.getInputStream();
final BufferedReader reader = new BufferedReader(new InputStreamReader(is, Charset.defaultCharset()));
final BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
final StringBuilder sb2 = new StringBuilder();
String line = null;
try {
@ -80,4 +80,4 @@ public abstract class CitrixConsoleProxyLoadCommandWrapper<T extends Command, A
return new ConsoleProxyLoadAnswer(cmd, proxyVmId, proxyVmName, success, result);
}
}
}

View File

@ -63,7 +63,7 @@ public class ConsoleProxyCmdHandler implements HttpHandler {
Headers hds = t.getResponseHeaders();
hds.set("Content-Type", "text/plain");
t.sendResponseHeaders(200, 0);
OutputStreamWriter os = new OutputStreamWriter(t.getResponseBody());
OutputStreamWriter os = new OutputStreamWriter(t.getResponseBody(),"UTF-8");
statsCollector.getStatsReport(os);
os.close();
}