Cannot add null to ArrayList - UnsupportedOperationException
43 views
Skip to first unread message
Ratnadeep Rakshit
unread,
Jan 25, 2011, 8:20:22 AM1/25/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google App Engine
Hi,
I am using GAE SDK 1.4.0 for developing my application. I want to
create a list with few null values in the middle. I am getting a
strange exception since afternoon. Here's the snippet of it ---
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:131)
at java.util.AbstractList.add(AbstractList.java:91)
at com.example.web.util.paging.MyClass.setCursorForPage(MyClass.java:
275)
at com.example.web.util.paging.MyClass.updatePageCursors(MyClass.java:
267)
I have defined my list somehow like that :
List<Cursor> cursors = new ArrayList<Cursor>();
and the line where I get the exception is here -
Line 275: cursors.add(null);
My question is , why is the call leading to the AbstractList.java:131?
I am using ArrayList ( also tried with a vector) but the call ends up
in the AbstractList class which just throws the
UnsupportedOperationException - it does nothing else.
Similar code runs very well in Tomcat/Glassfish...whats different in
AppEngine??