smolnar82 commented on a change in pull request #361:
URL: https://github.com/apache/knox/pull/361#discussion_r454390890



##########
File path: 
gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/ZookeeperRemoteAliasService.java
##########
@@ -190,13 +190,18 @@ private static void checkPathsExist(final 
RemoteConfigurationRegistryClient remo
      *
      * @param clusterName
      *            cluster name
-     * @return List of all the aliases
+     * @return List of all the aliases (an empty list, in case there is no 
alias for the given cluster)
      */
     @Override
     public List<String> getAliasesForCluster(final String clusterName) throws 
AliasServiceException {
-        final List<String> localAliases = 
localAliasService.getAliasesForCluster(clusterName);
+        final List<String> localAliases = localAliasService == null ? 
Collections.emptyList() : localAliasService.getAliasesForCluster(clusterName);
         if (localAliases == null || localAliases.isEmpty()) {
-          return remoteClient == null ? new ArrayList<>() : 
remoteClient.listChildEntries(buildClusterEntryName(clusterName));
+          if (remoteClient != null) {
+            final List<String> remoteAliases = 
remoteClient.listChildEntries(buildClusterEntryName(clusterName));
+            return remoteAliases == null ? new ArrayList<>() : remoteAliases;

Review comment:
       I just wanted to be consistent with the `null` case.




----------------------------------------------------------------
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]


Reply via email to