Announcement Announcement Module
Collapse
No announcement yet.
About using aclManager.getAcls() return null? Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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);

    Comment

    Working...
    X