ndimiduk commented on code in PR #5853:
URL: https://github.com/apache/hbase/pull/5853#discussion_r1596467045


##########
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Strings.java:
##########
@@ -94,4 +102,37 @@ public static String padFront(String input, char padding, 
int length) {
     int numPaddingCharacters = length - input.length();
     return StringUtils.repeat(padding, numPaddingCharacters) + input;
   }
+
+  /**
+   * Parse the query string of an URI to a key value map. If a single key 
occurred multiple times,
+   * only the first one will take effect.
+   */
+  public static Map<String, String> parseURIQueries(URI uri) {
+    if (StringUtils.isBlank(uri.getRawQuery())) {
+      return Collections.emptyMap();
+    }
+    return 
Splitter.on('&').trimResults().splitToStream(uri.getRawQuery()).map(kv -> {

Review Comment:
   Or do we have `org.apache.http.client.utils.URLEncodedUtils` on the 
classpath?



##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ZKConnectionRegistryURIFactory.java:
##########
@@ -30,9 +30,9 @@
  * Connection registry creator implementation for creating {@link 
ZKConnectionRegistry}.
  */
 @InterfaceAudience.Private
-public class ZKConnectionRegistryCreator implements 
ConnectionRegistryURIFactory {
+public class ZKConnectionRegistryURIFactory implements 
ConnectionRegistryURIFactory {

Review Comment:
   Good name choice 👍 



##########
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Strings.java:
##########
@@ -94,4 +102,37 @@ public static String padFront(String input, char padding, 
int length) {
     int numPaddingCharacters = length - input.length();
     return StringUtils.repeat(padding, numPaddingCharacters) + input;
   }
+
+  /**
+   * Parse the query string of an URI to a key value map. If a single key 
occurred multiple times,
+   * only the first one will take effect.
+   */
+  public static Map<String, String> parseURIQueries(URI uri) {
+    if (StringUtils.isBlank(uri.getRawQuery())) {
+      return Collections.emptyMap();
+    }
+    return 
Splitter.on('&').trimResults().splitToStream(uri.getRawQuery()).map(kv -> {

Review Comment:
   Why manually decode values when you can call `getQuery()`, which explicitly 
does the decoding for you?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to