zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eribeiro <...@git.apache.org>
Subject [GitHub] zookeeper pull request #279: ZOOKEEPER-2804:Node creation fails with NPE if ...
Date Tue, 13 Jun 2017 17:49:55 GMT
Github user eribeiro commented on a diff in the pull request:

    --- Diff: src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java ---
    @@ -915,11 +915,13 @@ protected void pRequest(Request request) throws RequestProcessorException
         private List<ACL> removeDuplicates(List<ACL> acl) {
             ArrayList<ACL> retval = new ArrayList<ACL>();
    -        Iterator<ACL> it = acl.iterator();
    -        while (it.hasNext()) {
    -            ACL a = it.next();
    -            if (retval.contains(a) == false) {
    -                retval.add(a);
    +        if(acl != null) {
    --- End diff --
    Good point. I added the check for nulls on `removeDuplicates` because `Set` doesn't accept
null entries. So, if there is a null in `acl` list then the first snippet I suggested would
throw an exception.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message