You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/10/02 16:10:04 UTC

[GitHub] [zookeeper] eolivelli commented on a change in pull request #1475: Zookeeper muse bugbash2020 check null child names

eolivelli commented on a change in pull request #1475:
URL: https://github.com/apache/zookeeper/pull/1475#discussion_r498914836



##########
File path: zookeeper-recipes/zookeeper-recipes-queue/src/main/java/org/apache/zookeeper/recipes/queue/DistributedQueue.java
##########
@@ -94,13 +98,17 @@ private String smallestChildName() throws KeeperException, InterruptedException
         long minId = Long.MAX_VALUE;
         String minName = "";
 
-        List<String> childNames;
+        List<String> childNames = null;
 
         try {
             childNames = zookeeper.getChildren(dir, false);
         } catch (KeeperException.NoNodeException e) {
             LOG.warn("Unexpected exception", e);
             return null;
+        } finally {
+            if (childNames == null) {
+                return null;

Review comment:
       returning in a finally block is a code smell.
   can we return "null" when we are out of the try block ?




----------------------------------------------------------------
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:
users@infra.apache.org