You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2014/11/17 16:57:11 UTC

IntHashMap is transient

Hi,

https://issues.apache.org/jira/browse/WICKET-5751 and
https://issues.apache.org/jira/browse/WICKET-5584 show a problem with the
deserialization of IntHashMap
<https://github.com/apache/wicket/blob/master/wicket-util/src/main/java/org/apache/wicket/util/collections/IntHashMap.java>
.

Many of its fields are transient for some reason and this leads to
NullPointerExceptions when instances of IntHashMap are used after
deserialization.

Anyone have idea why these fields are transient ?


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

Re: IntHashMap is transient

Posted by Andrea Del Bene <an...@gmail.com>.
I've noted this when I gave a quick look at WICKET-5751 but honestly I 
don't have any idea...
> Hi,
>
> https://issues.apache.org/jira/browse/WICKET-5751 and
> https://issues.apache.org/jira/browse/WICKET-5584 show a problem with the
> deserialization of IntHashMap
> <https://github.com/apache/wicket/blob/master/wicket-util/src/main/java/org/apache/wicket/util/collections/IntHashMap.java>
> .
>
> Many of its fields are transient for some reason and this leads to
> NullPointerExceptions when instances of IntHashMap are used after
> deserialization.
>
> Anyone have idea why these fields are transient ?
>
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>


Re: IntHashMap is transient

Posted by Martin Grigorov <mg...@apache.org>.
Oh, so obvious!
Thanks, Johan !

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Nov 18, 2014 at 1:29 AM, Johan Compagner <jc...@gmail.com>
wrote:

> Ehh serialisation is done in read and writeobject methods, all the stuff
> should be created there (readObject)
>
> The entry array is not meant to be serialized by itself.
>
> At first sight it seem to be correct, the sizes are serialized and then an
> int + object pair is done. And the read creates the table and reads the
> pairs back in.
> Op 17 nov. 2014 20:20 schreef "Sven Meier" <sv...@meiers.net>:
>
> > Hi Martin,
> >
> > I don't know why the fields are transient, Johan probably never expected
> > the map to be serialized.
> >
> > Sven
> >
> > On 11/17/2014 04:57 PM, Martin Grigorov wrote:
> >
> >> Hi,
> >>
> >> https://issues.apache.org/jira/browse/WICKET-5751 and
> >> https://issues.apache.org/jira/browse/WICKET-5584 show a problem with
> the
> >> deserialization of IntHashMap
> >> <https://github.com/apache/wicket/blob/master/wicket-
> >> util/src/main/java/org/apache/wicket/util/collections/IntHashMap.java>
> >> .
> >>
> >> Many of its fields are transient for some reason and this leads to
> >> NullPointerExceptions when instances of IntHashMap are used after
> >> deserialization.
> >>
> >> Anyone have idea why these fields are transient ?
> >>
> >>
> >> Martin Grigorov
> >> Wicket Training and Consulting
> >> https://twitter.com/mtgrigorov
> >>
> >>
> >
>

Re: IntHashMap is transient

Posted by Johan Compagner <jc...@gmail.com>.
Ehh serialisation is done in read and writeobject methods, all the stuff
should be created there (readObject)

The entry array is not meant to be serialized by itself.

At first sight it seem to be correct, the sizes are serialized and then an
int + object pair is done. And the read creates the table and reads the
pairs back in.
Op 17 nov. 2014 20:20 schreef "Sven Meier" <sv...@meiers.net>:

> Hi Martin,
>
> I don't know why the fields are transient, Johan probably never expected
> the map to be serialized.
>
> Sven
>
> On 11/17/2014 04:57 PM, Martin Grigorov wrote:
>
>> Hi,
>>
>> https://issues.apache.org/jira/browse/WICKET-5751 and
>> https://issues.apache.org/jira/browse/WICKET-5584 show a problem with the
>> deserialization of IntHashMap
>> <https://github.com/apache/wicket/blob/master/wicket-
>> util/src/main/java/org/apache/wicket/util/collections/IntHashMap.java>
>> .
>>
>> Many of its fields are transient for some reason and this leads to
>> NullPointerExceptions when instances of IntHashMap are used after
>> deserialization.
>>
>> Anyone have idea why these fields are transient ?
>>
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>>
>

Re: IntHashMap is transient

Posted by Sven Meier <sv...@meiers.net>.
Hi Martin,

I don't know why the fields are transient, Johan probably never expected 
the map to be serialized.

Sven

On 11/17/2014 04:57 PM, Martin Grigorov wrote:
> Hi,
>
> https://issues.apache.org/jira/browse/WICKET-5751 and
> https://issues.apache.org/jira/browse/WICKET-5584 show a problem with the
> deserialization of IntHashMap
> <https://github.com/apache/wicket/blob/master/wicket-util/src/main/java/org/apache/wicket/util/collections/IntHashMap.java>
> .
>
> Many of its fields are transient for some reason and this leads to
> NullPointerExceptions when instances of IntHashMap are used after
> deserialization.
>
> Anyone have idea why these fields are transient ?
>
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>