You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by un...@apache.org on 2004/09/17 16:49:12 UTC

cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/method AclMethod.java

unico       2004/09/17 07:49:12

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        AclMethod.java
  Log:
  fix NPE when adding ACE with non-existent privilege
  
  Revision  Changes    Path
  1.46      +14 -7     jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AclMethod.java
  
  Index: AclMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AclMethod.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- AclMethod.java	9 Aug 2004 12:05:29 -0000	1.45
  +++ AclMethod.java	17 Sep 2004 14:49:12 -0000	1.46
  @@ -166,9 +166,16 @@
           while (privilegeIt.hasNext()) {
               Element privilegeElm = (Element)privilegeIt.next();
               actionUri = createActionUri(privilegeElm);
  -            NodePermission np = new NodePermission(objectUri, subjectUri, actionUri, true, negative);
  -            np.setInvert(invert);
  -            result.add(np);
  +            if (actionUri == null) {
  +                throw new PreconditionViolationException(
  +                    new ViolatedPrecondition("not-supported-privilege", WebdavStatus.SC_BAD_REQUEST), resourcePath
  +                );
  +            }
  +            else {
  +                NodePermission np = new NodePermission(objectUri, subjectUri, actionUri, true, negative);
  +                np.setInvert(invert);
  +                result.add(np);
  +            }
           }
           return result;
       }
  @@ -226,7 +233,7 @@
           else {
               ObjectNode actions = structure.retrieve(slideToken, token.getNamespaceConfig().getActionsPath());
               ObjectNode action = findAction(actions.getChildren().iterator(), privilegeName, privilegeNamespace);
  -            return action.getUri();
  +            return action != null ? action.getUri() : null;
           }
       }
       
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org