You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Anthony Nguyen <ar...@ariesboy.com> on 2001/10/20 00:17:48 UTC

NullPointerException in client (Slide class)


  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



Re: NullPointerException in client (Slide class)

Posted by Dirk Verbeeck <di...@pandora.be>.
Anthony Nguyen wrote:
> 
>   private void showAces(String path, Ace[] aces)
<snip>
> 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

Hi Anthony

Thanks for the patch!
I have applied it and did the same fix for the other properties.


Dirk