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
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
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
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 s...@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
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 jcompag...@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 s...@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