[Building Sakai] Full JSP CRUD tool

Aaron Zeckoski aaronz at vt.edu
Mon May 11 10:00:33 PDT 2009


Unless something has really changed somewhere it should be impossible
for the list returned to be null from either one of those. They are
just passing through to the following methods which are supposed to
not return null:
org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(DetachedCriteria
criteria, int firstResult, int maxResults)
org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(DetachedCriteria
criteria, int firstResult, int maxResults

Would it be possible to trace the code and see what is going on in
more detail? Are there are errors in the logs at all?
-AZ

On Mon, May 11, 2009 at 5:53 PM, Steve Swinsburg
<s.swinsburg at lancaster.ac.uk> wrote:
> The issue is that the List is null and .size() is being called on it which
> will throw the NPE. It should have been populated, or at least turned into
> an empty list in one of these methods:
>   if (locationId == null) {
>         // get all items
>         l = dao.findAll(OtrotodoItem.class);
>      } else {
>         l = dao.findBySearch(OtrotodoItem.class,
>               new Search("locationId", locationId) );
>      }
>
> I'd be looking there to check what's happening.
>
> cheers,
> Steve
> ---
> Steve Swinsburg
> Portal Systems Developer
> Centre for e-Science
> Lancaster University
> Lancaster
> LA1 4YT
>
> email: s.swinsburg at lancaster.ac.uk
> phone: +44 (0) 1524 594870
> On 11/05/2009, at 5:23 PM, menjuanpablo wrote:
>
> hi,
> the line 98 is in the fuction getallvisibleitems,
> public List<OtrotodoItem> getAllVisibleItems(String locationId, String
> userId) {
>      log.debug("Fetching visible items for " + userId + " in site: " +
> locationId);
>      List<OtrotodoItem> l = null;
>      if (locationId == null) {
>         // get all items
>         l = dao.findAll(OtrotodoItem.class);
>      } else {
>         l = dao.findBySearch(OtrotodoItem.class,
>               new Search("locationId", locationId) );
>      }
>      // check if the current user can see all items (or is super user)
>      if ( externalLogic.isUserAdmin(userId) ||
>            externalLogic.isUserAllowedInLocation(userId,
> ExternalLogic.ITEM_READ_HIDDEN, locationId) ) {
>         log.debug("Security override: " + userId + " able to view all
> items");
>      } else {
>         // go backwards through the loop to avoid hitting the "end" early
> LINE 98        for (int i=l.size()-1; i >= 0; i--) { :working:
>            OtrotodoItem item = (OtrotodoItem) l.get(i);
>            if ( item.getHidden().booleanValue() &&
>                  !item.getOwnerId().equals(userId) ) {
>               l.remove(item);
>            }
>         }
>      }
>      return l;
>   }
>
>
> --
> View this message in context:
> http://www.nabble.com/Full-JSP-CRUD-tool-tp23437843p23486638.html
> Sent from the Sakai - Development mailing list archive at Nabble.com.
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org
> with a subject of "unsubscribe"
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org
> with a subject of "unsubscribe"
>
>



-- 
Aaron Zeckoski (aaronz at vt.edu)
Senior Research Engineer - CARET - Cambridge University
[http://bugs.sakaiproject.org/confluence/display/~aaronz/]
Sakai Fellow - [http://aaronz-sakai.blogspot.com/]


More information about the sakai-dev mailing list