dhlaluku commented on a change in pull request #3091: Address reviewers from 
abandoned PR #1597.
URL: https://github.com/apache/cloudstack/pull/3091#discussion_r247993618
 
 

 ##########
 File path: 
services/console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyHttpHandlerHelper.java
 ##########
 @@ -23,20 +23,34 @@
 
 public class ConsoleProxyHttpHandlerHelper {
     private static final Logger s_logger = 
Logger.getLogger(ConsoleProxyHttpHandlerHelper.class);
+    private static final String AND = "&";
+    private static final String EQUALS = "=";
+    private static final String HOST = "host";
+    private static final String PORT = "port";
+    private static final String SID = "sid";
+    private static final String TAG = "tag";
+    private static final String CONSOLE_URL = "consoleurl";
+    private static final String SESSION_REF = "sessionref";
+    private static final String TICKET = "ticket";
+    private static final String LOCALE = "locale";
+    private static final String HYPERV_HOST = "hypervHost";
+    private static final String USERNAME = "username";
+    private static final String PASSWORD = "password";
+    private static final String TOKEN = "token";
 
     public static Map<String, String> getQueryMap(String query) {
-        String[] params = query.split("&");
+        String[] params = query.split(AND);
         Map<String, String> map = new HashMap<String, String>();
         for (String param : params) {
-            String[] paramTokens = param.split("=");
+            String[] paramTokens = param.split(EQUALS);
             if (paramTokens != null && paramTokens.length == 2) {
-                String name = param.split("=")[0];
-                String value = param.split("=")[1];
+                String name = paramTokens[0];
+                String value = paramTokens[1];
                 map.put(name, value);
 
 Review comment:
   I think another "if n(name.equalsIgnoreCase(TOKEN)" is needed here 
considering that the map should only contain a "TOKEN" key.  and then remove 
"guardUserInput(map)" call in line 59

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to