openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julien Kronegg (JIRA)" <>
Subject [jira] Commented: (OPENJPA-1025) AbstractResultList.subList throws UnsupportedOperationException
Date Fri, 01 May 2009 07:29:30 GMT


Julien Kronegg commented on OPENJPA-1025:

I agree. The subList method can be kept in AbstractResultList (BTW it's not AbstractList)
and the subclasses overriden subList method will be called.
This is a more "backward compatible" fix.

> AbstractResultList.subList throws UnsupportedOperationException
> ---------------------------------------------------------------
>                 Key: OPENJPA-1025
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: lib
>    Affects Versions: 1.2.1, 1.3.0, 2.0.0
>         Environment:,
> Seam 2.0, OpenJPA 1.2.1
>            Reporter: Julien Kronegg
>            Assignee: B.J. Reed
>         Attachments: OPENJPA-1025-withTest.patch, OPENJPA-1025.patch, OPENJPA-1025b.patch
>   Original Estimate: 4h
>  Remaining Estimate: 4h
> AbstractResultList implements the basics for readonly result lists. When calling the
subList(int,int) method, the following exception is raised:
>     java.lang.UnsupportedOperationException
>     at org.apache.openjpa.lib.rop.AbstractResultList.subList(
>     at org.apache.openjpa.kernel.DelegatingResultList.subList(
>     ...
> Since the subList() method contract is to create a new List from the ResultList, this
operation does not modify the original list: it only provides a *view* on the original list
(see ). 
> This problem is also found by other users:
> They found the (bad) workaround to build a new List (bad because this is not the same
as calling subList()):
>     List mySubList = new ArrayList(openjpaList).subList(from, to);
> The AbstractResultList class should be modified by one of this solution (sorted by decreasing
preference order):
> 1) the AbstractResultList class should extends java.util.AbstractList and the subList()
method should be removed (because implemented by AbstractList)
> 2) the subList() method should be implemented to return a view on the original list.
See java.util.AbstractList for an implementation (
> 3) the subList() method should throw the exception with the message "this method is not
yet implemented. Workaround: new ArrayList(openjpaList).subList(from, to)"

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message