From 913e3552801aae7cc2e4c58e2b14df930260861b Mon Sep 17 00:00:00 2001 From: Naduni Pamudika Date: Fri, 3 Jan 2025 18:39:23 +0530 Subject: [PATCH] Fix integration test failures by handling a NPE --- .../main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java index 5f2adfdccfbb..e4026ba9b8fb 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java +++ b/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java @@ -5055,7 +5055,7 @@ public static Set extractVisibleEnvironmentsForUser(List en String[] permittedRoles = environment.getVisibilityRoles(); if (permittedRoles != null && permittedRoles[0].equals("all")) { environmentStringSet.add(environment.toString()); - } else { + } else if (permittedRoles != null) { for (String role : userRoles) { for (String permission : permittedRoles) { if (role.equals(permission)) { @@ -5063,6 +5063,8 @@ public static Set extractVisibleEnvironmentsForUser(List en } } } + } else { + environmentStringSet.add(environment.toString()); } } }