zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From LJ1043041006 <...@git.apache.org>
Subject [GitHub] zookeeper pull request #495: ZOOKEEPER-3007:Potential NPE in ReferenceCounte...
Date Tue, 27 Mar 2018 03:20:26 GMT
Github user LJ1043041006 commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/495#discussion_r177296763
  
    --- Diff: src/java/main/org/apache/zookeeper/server/ReferenceCountedACLCache.java ---
    @@ -109,16 +109,18 @@ public synchronized void deserialize(InputArchive ia) throws IOException
{
                 }
                 List<ACL> aclList = new ArrayList<ACL>();
                 Index j = ia.startVector("acls");
    -            while (!j.done()) {
    -                ACL acl = new ACL();
    -                acl.deserialize(ia, "acl");
    -                aclList.add(acl);
    -                j.incr();
    +            if (j != null) {
    +                while (!j.done()) {
    +                    ACL acl = new ACL();
    +                    acl.deserialize(ia, "acl");
    +                    aclList.add(acl);
    +                    j.incr();
    +                }
    +                longKeyMap.put(val, aclList);
    --- End diff --
    
    Can we move code at line 119~123 out of null-checker, because it may cause endless loop
due to i > 0 may always hold


---

Mime
View raw message