Results 1 to 2 of 2

Thread: About using aclManager.getAcls() return null?

Hybrid View

  1. #1
    Join Date
    Dec 2005
    Posts
    2

    Default About using aclManager.getAcls() return null?

    Hi,All
    my Hibernate class method:
    public BookStore selBookStore (Integer bookStoreId) throws DataAccessException {
    logger.info("selBookStore......");
    BookStore bookStore= (BookStore)this.getHibernateTemplate().get(BookSto re.class, bookStoreId);
    return bookStore;
    }
    and then Action class method:
    public ModelAndView handleRequest(HttpServletRequest request,
    HttpServletResponse response) throws ServletException, IOException {
    int bookStoreId = RequestUtils.getRequiredIntParameter(request, "bookStoreId");
    BookStore bookStore = ibaoKaoDAO.selBookStore(new Integer(bookStoreId));
    if(bookStoreId==null){
    return null;
    }
    Map model = new HashMap();
    try{
    AclEntry[] acls = aclManager.getAcls(bookStore);
    model.put("bookStore", bookStore);
    model.put("acls", acls);
    }
    catch(Exception e){
    System.out.println(e.toString());
    }
    return new ModelAndView("adminPermission", "model", model);
    }
    I am printing acls[0] ,acl[0] return is null and throw Exception is:java.lang.NullPointerException
    why invoke aclManager.getAcls(bookStore) return null and i am sure that bookStore is not null?

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Quote Originally Posted by acegiboy
    why invoke aclManager.getAcls(bookStore) return null and i am sure that bookStore is not null?
    As per the interface contract for AclManager:

    /**
    * Obtains the ACLs that apply to the specified domain instance.
    *
    * @param domainInstance the instance for which ACL information is required
    * (never <code>null</code>)
    *
    * @return the ACLs that apply, or <code>null</code> if no ACLs apply to
    * the specified domain instance
    */
    public AclEntry[] getAcls(Object domainInstance);
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •