You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by aledsage <gi...@git.apache.org> on 2014/11/03 16:44:25 UTC
[GitHub] incubator-brooklyn pull request: Brooklyn node and cluster upgrade
Github user aledsage commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/272#discussion_r19740222
--- Diff: utils/common/src/main/java/brooklyn/util/net/Urls.java ---
@@ -142,6 +143,11 @@ public static String mergePaths(String ...items) {
public static String encode(String text) {
return URLEncoder.encode(text);
}
+ /** As {@link #encode(String)} */
+ @SuppressWarnings("deprecation")
+ public static String decode(String text) {
+ return URLDecoder.decode(text);
--- End diff --
Will this work as expected? The `java.net.URLDecoder` is for "HTML form decoding" (e.g. "+" is converted to a space). But quite a few stackoverflow answers talk about just using `URLDecoder` for each part of the URI.
There is also a guava discussion about adding a decoder to complement `com.google.common.net.UrlEscapers` (https://github.com/google/guava/issues/1691) but that functionality is not available in guava yet.
Also, why not pass "UTF-8" as the encoding scheme, rather than calling the deprecated method? The javadoc says "Note: The World Wide Web Consortium Recommendation states that UTF-8 should be used. Not doing so may introduce incompatibilites."
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---