bug 7228: the exception found in this bug actually does not affect normal function but rather a ugly log message. add some protection to ignore invalid parameter from URL

This commit is contained in:
Kelven Yang 2010-12-06 11:58:33 -08:00
parent 864c35d615
commit 92815fc9f7

View File

@ -185,10 +185,16 @@ public class ConsoleProxyAjaxHandler implements HttpHandler {
public static Map<String, String> getQueryMap(String query) {
String[] params = query.split("&");
Map<String, String> map = new HashMap<String, String>();
for (String param : params) {
String name = param.split("=")[0];
String value = param.split("=")[1];
map.put(name, value);
for (String param : params) {
String[] paramTokens = param.split("=");
if(paramTokens != null && paramTokens.length == 2) {
String name = param.split("=")[0];
String value = param.split("=")[1];
map.put(name, value);
} else {
if(s_logger.isDebugEnabled())
s_logger.debug("Invalid paramemter in URL found. param: " + param);
}
}
return map;
}