I have found the error.

List Result = new ArrayList<PlatformDTO>(); must be defined outside of the
iterator method

and also the answer to my question. 

When the result is empty or null, then I must return a null iterator



T Ames wrote:
> 
> I see several undefined objects:
> 
> result
> requestFormModel
> it
> 
> If these are defined at the class level, they must be serializable.
> 
> If you have Logging set at Info, Wicket will give you the actual field
> that
> is not serializable, although from the error it looks like something to do
> with AbstractList
> 
> Iterator objects are not serializable.  I would look at how you are
> defining
> the "it" variable.
> 
> 
> 
> On Mon, Sep 28, 2009 at 7:25 AM, Charles Moulliard
> <[email protected]>wrote:
> 
>> Hi,
>>
>> I would like to know what is the best way to work with the method
>> iterator of DataProvider.
>>
>> I have created a class implementing IDataProvider. Depending of a
>> parameter, the DAO service called is not the same inside in the
>> iterator method. For some DAO services, a list is returned but for one
>> service, an object is returned instead of a list.
>>
>> If I try to create a ArrayList inside the iterator, the following
>> error is generated :
>>
>>
>> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
>> Unable to serialize class: java.util.AbstractList$Itr
>> Field hierarchy is:
>>  0 [class=com.xpectis.x3s.fundbox.web.RequestPage, path=0]
>>    private java.lang.Object
>> org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
>>      java.lang.Object org.apache.wicket.Component.data[3]
>> [class=com.xpectis.x3s.fundbox.web.RequestPage$1, path=0:requestList]
>>        private final
>> org.apache.wicket.markup.repeater.data.IDataProvider
>> org.apache.wicket.markup.repeater.data.DataViewBase.dataProvider
>> [class=com.xpectis.x3s.fundbox.web.data.RequestProvider]
>>          private java.util.Iterator
>> com.xpectis.x3s.fundbox.web.data.RequestProvider.it
>> [class=java.util.AbstractList$Itr] <----- field that is not
>> serializable
>>        at
>> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:346)
>>
>> How can I avoid this issue ?
>>
>> Here is my code :
>>
>> public class RequestProvider implements IDataProvider {
>>
>> ...
>>
>>        public Iterator iterator(int first, int count) {
>>
>>                result = new ArrayList<PlatformDTO>();
>>
>>                if (requestFormModel != null) {
>>
>>                        if (requestFormModel.getId() != null) {
>>                                request =
>> requestService.getRequest(requestFormModel.getId());
>>                                result.add(request);
>>                                it = result.iterator();
>>
>>                        } else if (requestFormModel.getFileName() != null)
>> {
>>                                it =
>> requestService.findRequestByFileName(requestFormModel.getFileName()).iterator();
>>
>>                        }
>>
>> Regards,
>>
>>
>> Charles Moulliard
>> Senior Enterprise Architect
>> Apache Camel Committer
>>
>> *****************************
>> blog : http://cmoulliard.blogspot.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
> 
> 


-----
Charles Moulliard
SOA Architect

My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: 
http://www.nabble.com/Best-way-to-work-with-the-iterator-of-IDataProvider-tp25644122p25645386.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to