private void showAces(String path, Ace[] aces)
  {
    System.out.println("ACL for " + path + ":");

System.out.println("--------------------------------------------------------
----");
    for (int i=0; i<aces.length ; i++)
    {
      Ace ace=aces[i];
      System.out.println((!ace.isNegative()?"granted":"denied") +
        " to " + ace.getPrincipal() + " " +
        "   (" + (ace.isProtected()?"protected":"not protected") + ")" +
        "   (" + (ace.isInherited()? ("inherited from '" +
ace.getInheritedFrom() + "'"): "not inherited") +")");

      Enumeration privileges=ace.enumeratePrivileges();
      while (privileges.hasMoreElements())
      {
        Privilege priv=(Privilege)privileges.nextElement();
        System.out.println("   " + priv.getNamespace() + priv.getName() + "
" + (priv.getParameter()==null?"":("("+priv.getParameter()+")")));
      }
    }

System.out.println("--------------------------------------------------------
----");
  }

In the method above, there is a possibility that the array passed in is
null. To fix this problem I added the following code to the beginning of the
method:

    if (aces==null) {
      System.out.println("Error: PropFind didn't return an AclProperty!");
      return;
    }


Anthony Nguyen


Reply via email to