narendly commented on a change in pull request #829: Fix bugs in 
ZkRoutingDataReader and ZkRoutingDataWriter
URL: https://github.com/apache/helix/pull/829#discussion_r385449484
 
 

 ##########
 File path: 
helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataReader.java
 ##########
 @@ -87,13 +96,18 @@ public ZkRoutingDataReader(String namespace, String 
zkAddress,
           "Routing data directory ZNode " + 
MetadataStoreRoutingConstants.ROUTING_DATA_PATH
               + " does not exist. Routing ZooKeeper address: " + _zkAddress);
     }
-    for (String realmAddress : allRealmAddresses) {
-      ZNRecord record =
-          _zkClient.readData(MetadataStoreRoutingConstants.ROUTING_DATA_PATH + 
"/" + realmAddress);
-      List<String> shardingKeys =
-          
record.getListField(MetadataStoreRoutingConstants.ZNRECORD_LIST_FIELD_KEY);
-      routingData
-          .put(realmAddress, shardingKeys != null ? shardingKeys : 
Collections.emptyList());
+    if (allRealmAddresses != null)
+    {
+      for (String realmAddress : allRealmAddresses) {
+        ZNRecord record =
+            _zkClient.readData(MetadataStoreRoutingConstants.ROUTING_DATA_PATH 
+ "/" + realmAddress);
+        if (record != null) {
+          List<String> shardingKeys =
+              
record.getListField(MetadataStoreRoutingConstants.ZNRECORD_LIST_FIELD_KEY);
+          routingData
+              .put(realmAddress, shardingKeys != null ? shardingKeys : 
Collections.emptyList());
+        }
+      }
 
 Review comment:
   format

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to