You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/12/19 17:10:17 UTC

[GitHub] [hadoop] goiri commented on a diff in pull request #5236: MAPREDUCE-7429 Application log link is not accessible via TimelineServer WebUI in IPV6 scenario

goiri commented on code in PR #5236:
URL: https://github.com/apache/hadoop/pull/5236#discussion_r1052442938


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java:
##########
@@ -247,6 +247,24 @@ public static InetSocketAddress createSocketAddr(String target,
     return createSocketAddrForHost(host, port);
   }
 
+  public static String normalizeV6Address(String target) {
+    if (!target.startsWith("[")) {
+      if (target.contains("%")) {
+        int i = target.lastIndexOf('%');
+        target = target.trim();
+        String port = target.substring(target.lastIndexOf(":") + 1);
+        String addr = target.substring(0, i);
+        target = "[" + addr + "]" + ":" + port;

Review Comment:
   Make the input target final in the declaration and return a new variable.
   ```
   public static String normalizeV6Address(final String target) {
   ```



##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java:
##########
@@ -247,6 +247,24 @@ public static InetSocketAddress createSocketAddr(String target,
     return createSocketAddrForHost(host, port);
   }
 
+  public static String normalizeV6Address(String target) {

Review Comment:
   Add unit tests for this.



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineConnector.java:
##########
@@ -197,6 +199,12 @@ private static void setTimeouts(URLConnection connection, int socketTimeout) {
 
   public static URI constructResURI(Configuration conf, String address,
       String uri) {
+    if (StringUtils.countMatches(address, ":") > 2) {

Review Comment:
   This probable be in NetUtils and be a proper isIPV6Address() or something.



##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java:
##########
@@ -247,6 +247,24 @@ public static InetSocketAddress createSocketAddr(String target,
     return createSocketAddrForHost(host, port);
   }
 
+  public static String normalizeV6Address(String target) {
+    if (!target.startsWith("[")) {

Review Comment:
   I'm pretty sure regex would help here.



-- 
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: common-issues-unsubscribe@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org