smolnar82 commented on a change in pull request #361:
URL: https://github.com/apache/knox/pull/361#discussion_r454391965
##########
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;
+ } else {
+ return new ArrayList<>();
Review comment:
I've no idea if it should be mutable and I did not want to touch that
part -> this is why I use the same way to return in the other case too.
----------------------------------------------------------------
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]