Address reviewers from abandoned PR #1597.#3091
Address reviewers from abandoned PR #1597.#3091GabrielBrascher wants to merge 1 commit intoapache:masterapache/cloudstack:masterfrom CLDIN:address-abandoned-pr-1597CLDIN/cloudstack:address-abandoned-pr-1597Copy head branch name to clipboard
Conversation
...console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyHttpHandlerHelper.java
Outdated
Show resolved
Hide resolved
...console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyHttpHandlerHelper.java
Show resolved
Hide resolved
...console-proxy/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyHttpHandlerHelper.java
Show resolved
Hide resolved
8de4362 to
58a7a6a
Compare
58a7a6a to
fd3945b
Compare
|
@blueorangutan package |
|
@rafaelweingartner a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2487 |
| private static final String TOKEN = "token"; | ||
|
|
||
| public static Map<String, String> getQueryMap(String query) { | ||
| String[] params = query.split("&"); |
There was a problem hiding this comment.
Is there a way to parse URL (possibly a get request) to get the key/value map of params?
There was a problem hiding this comment.
Yes, there is, thanks for pointing that!
I will ping you when update it (also extracting some lines to methods, bringing some test cases, and documenting).
|
@GabrielBrascher you can now package and kick tests yourself to help you with your 4.12 RM work |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2512 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Thanks, @rhtyd! I am going to update this PR soon, addressing your review, just missing a few test cases. |
|
Trillian test result (tid-3296)
|
| for (String param : params) { | ||
| String[] paramTokens = param.split("="); | ||
| String[] paramTokens = param.split(EQUALS); | ||
| if (paramTokens != null && paramTokens.length == 2) { |
There was a problem hiding this comment.
@GabrielBrascher can you change this line to this "If (ArrayUtils.isNotEmpty(paramTokens) && paramTokens.length == 2)"?
| 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>(); |
There was a problem hiding this comment.
This variable should be named "tokenMap" or something similar to show that it should only store a token key-value item.
This will save computation by getting rid of the guardUserInput(map) call in Line #59
| String value = param.split("=")[1]; | ||
| String name = paramTokens[0]; | ||
| String value = paramTokens[1]; | ||
| map.put(name, value); |
There was a problem hiding this 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
| s_logger.error("Unable to decode token"); | ||
| s_logger.error("Unable to decode token due to null console proxy client param"); | ||
| } | ||
| } else { |
There was a problem hiding this comment.
This else statement seems redundant and can go if the tokenMap only contains 1 TOKEN item
dhlaluku
left a comment
There was a problem hiding this comment.
@GabrielBrascher overall nice code refactoring. I left some suggestions for further code refactors
|
Thanks, @dhlaluku! I appreciate the review and I will ping you when updating the code. |
|
ping @GabrielBrascher is this PR abandoned or you still plan to submit changes? |
|
@rhtyd thanks for pinging, I will take a look at this PR. |
|
ping @GabrielBrascher |
|
Thanks for pointing this PR @rhtyd. I am removing the 4.13.0.0 milestone as it is not critical, I will get back on this one on the future. |
|
ping @GabrielBrascher any plans with this one, or should we move it to 4.15 milestone? |
|
@andrijapanicsb I will close this one for now. I shall get back to it when having some free time. |
Description
This PR addresses reviewers from PR #1597. If approved we can then close PR #1597.
Fixes: #1597
Types of changes
Screenshots (if appropriate):
How Has This Been Tested?