[ 
https://issues.apache.org/jira/browse/HADOOP-17843?focusedWorklogId=756954&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-756954
 ]

ASF GitHub Bot logged work on HADOOP-17843:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Apr/22 12:58
            Start Date: 14/Apr/22 12:58
    Worklog Time Spent: 10m 
      Work Description: hemanthboyina commented on code in PR #3290:
URL: https://github.com/apache/hadoop/pull/3290#discussion_r850414027


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java:
##########
@@ -1218,4 +1219,31 @@ public static InetAddress bindToLocalAddress(InetAddress 
localAddr, boolean
     }
     return null;
   }
+
+  /**
+   * Parse the given address into  IP & Port number pair.
+   * @param bindAddress IP Address to parse
+   * @return Pair of IP-Address & Port number.
+   */
+  public static Pair<String, Integer> parseAddress2IpAndPort(
+      String bindAddress) {
+    String[] parts = org.apache.hadoop.util.StringUtils
+        .split(bindAddress, ':');
+    Pair <String, Integer> pair = null;
+    //If bind address is IPv6
+    if (bindAddress.split(":").length > 2) {

Review Comment:
   can use parts.length > 2, as parts is equal to bindAddress.split(":")



##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java:
##########
@@ -1218,4 +1219,31 @@ public static InetAddress bindToLocalAddress(InetAddress 
localAddr, boolean
     }
     return null;
   }
+
+  /**
+   * Parse the given address into  IP & Port number pair.
+   * @param bindAddress IP Address to parse
+   * @return Pair of IP-Address & Port number.
+   */
+  public static Pair<String, Integer> parseAddress2IpAndPort(
+      String bindAddress) {
+    String[] parts = org.apache.hadoop.util.StringUtils
+        .split(bindAddress, ':');
+    Pair <String, Integer> pair = null;
+    //If bind address is IPv6
+    if (bindAddress.split(":").length > 2) {
+      String target = bindAddress;
+      int i = target.lastIndexOf(":");
+      String portNum = target.substring(i + 1);

Review Comment:
   can use parts array itself to find out the port ?





Issue Time Tracking
-------------------

    Worklog Id:     (was: 756954)
    Time Spent: 2h  (was: 1h 50m)

> Support IPV6 with IP for internal and external communication
> ------------------------------------------------------------
>
>                 Key: HADOOP-17843
>                 URL: https://issues.apache.org/jira/browse/HADOOP-17843
>             Project: Hadoop Common
>          Issue Type: Sub-task
>            Reporter: Renukaprasad C
>            Assignee: Renukaprasad C
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> Support IPV6 with IP for internal and external communication 
> WebAppProxy Service & embedded webapp mode



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to