This is an automated email from the ASF dual-hosted git repository.

yashmayya pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 782c83d96c1 Fix NPE in HelixHelper.getOfflineInstanceFromExternalView 
when resourceExternalView is null (#18455)
782c83d96c1 is described below

commit 782c83d96c18499c16fa9eb1d3f2c54c1207ba99
Author: Akanksha kedia <[email protected]>
AuthorDate: Tue May 12 05:22:28 2026 +0530

    Fix NPE in HelixHelper.getOfflineInstanceFromExternalView when 
resourceExternalView is null (#18455)
    
    The sibling method getOnlineInstanceFromExternalView already guards against 
a null
    ExternalView; apply the same null check to 
getOfflineInstanceFromExternalView so both
    methods are consistent and callers that pass a null view (e.g. when the 
resource is
    not yet created) get an empty set instead of a NullPointerException.
---
 .../org/apache/pinot/common/utils/helix/HelixHelper.java     | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git 
a/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java
 
b/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java
index 03955696130..e43aa6a4b8c 100644
--- 
a/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java
+++ 
b/pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java
@@ -324,11 +324,13 @@ public class HelixHelper {
    */
   public static Set<String> getOfflineInstanceFromExternalView(ExternalView 
resourceExternalView) {
     Set<String> instanceSet = new HashSet<String>();
-    for (String partition : resourceExternalView.getPartitionSet()) {
-      Map<String, String> stateMap = 
resourceExternalView.getStateMap(partition);
-      for (String instance : stateMap.keySet()) {
-        if (stateMap.get(instance).equalsIgnoreCase(OFFLINE)) {
-          instanceSet.add(instance);
+    if (resourceExternalView != null) {
+      for (String partition : resourceExternalView.getPartitionSet()) {
+        Map<String, String> stateMap = 
resourceExternalView.getStateMap(partition);
+        for (String instance : stateMap.keySet()) {
+          if (stateMap.get(instance).equalsIgnoreCase(OFFLINE)) {
+            instanceSet.add(instance);
+          }
         }
       }
     }


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

Reply via email to