adarshsanjeev commented on code in PR #15024:
URL: https://github.com/apache/druid/pull/15024#discussion_r1349497879


##########
server/src/main/java/org/apache/druid/server/coordination/DruidServerMetadata.java:
##########
@@ -42,7 +43,7 @@ public class DruidServerMetadata
   @JsonCreator
   public DruidServerMetadata(
       @JsonProperty("name") String name,
-      @JsonProperty("host") String hostAndPort,
+      @JsonProperty("host") @Nullable String hostAndPort,

Review Comment:
   Added a comment to the constructor



##########
server/src/main/java/org/apache/druid/rpc/ServiceLocation.java:
##########
@@ -47,6 +53,42 @@ public static ServiceLocation fromDruidNode(final DruidNode 
druidNode)
     return new ServiceLocation(druidNode.getHost(), 
druidNode.getPlaintextPort(), druidNode.getTlsPort(), "");
   }
 
+  private static final Splitter SPLITTER = Splitter.on(":").limit(2);
+
+  public static ServiceLocation fromDruidServerMetadata(final 
DruidServerMetadata druidServerMetadata)
+  {
+    final String host = getHostFromString(druidServerMetadata.getHost());
+    int plaintextPort = 
getPortFromString(druidServerMetadata.getHostAndPort());
+    int tlsPort = getPortFromString(druidServerMetadata.getHostAndTlsPort());
+    return new ServiceLocation(host, plaintextPort, tlsPort, "");
+  }
+
+  @Nullable
+  private static String getHostFromString(String s)
+  {
+    if (s == null) {

Review Comment:
   Added a check before this function



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to