[Building Sakai] Full JSP CRUD tool

Steve Swinsburg s.swinsburg at lancaster.ac.uk
Mon May 11 09:53:49 PDT 2009


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"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090511/ef8f0843/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2437 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090511/ef8f0843/attachment.bin 


More information about the sakai-dev mailing list