Cannot add null to ArrayList - UnsupportedOperationException

43 views
Skip to the first unread message

Ratnadeep Rakshit

unread,
25 Jan 2011, 08:20:2225/01/2011
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??

Please help!
Reply all
Reply to author
Forward
0 new messages