You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Johan Compagner (JIRA)" <ji...@apache.org> on 2008/04/02 19:41:24 UTC

[jira] Closed: (WICKET-1474) Page serialization bug, when a class hierarchy doesn't implement Serializable in a "consistent" way

     [ https://issues.apache.org/jira/browse/WICKET-1474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Compagner closed WICKET-1474.
-----------------------------------

    Resolution: Won't Fix

this is something we cant fix...

because this is how serialization works
On the first none serializeable class a default constructor is called and that one is responsible for creating the object.
Then the sub class can if it can access fill in also the fields of its super. But thats just it.

> Page serialization bug, when a class hierarchy doesn't implement Serializable in a "consistent" way
> ---------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-1474
>                 URL: https://issues.apache.org/jira/browse/WICKET-1474
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.3.0-beta1, 1.3.0-beta2, 1.3.0-beta3, 1.3.0-beta4, 1.3.0-rc1, 1.3.0-rc2, 1.3.0-final, 1.3.1, 1.3.2, 1.3.3
>         Environment: Any (tried on Windows XP, Vista and Linux with JDK 1.5 and 1.6 and on both Tomcat 6.0 and Jetty 6.1.9
>            Reporter: Antoine Angénieux
>            Priority: Minor
>         Attachments: quickstart.tar.gz
>
>
> Here is when things go messy :
> I have an interface that does not extend Serializable and a base abstract class implementing the interface, but is still not serializable. Let's call these INonSerializable and ANonSerializable.
> This abstract class holds reference to a private object, and exposes a method which uses internally the private object reference, eg :
> public abstract class ANonSerializable implements INonSerializable {
> 	private Integer nb;
> 	public ANonSerializable() {
> 	    super();
> 	}
> 	public void setNb(Integer nb) {
> 		this.nb = nb;
> 	}
> 	public String getValue() {
> 		return nb.toString();
> 	}
> }
> An important note here is that the reference to the nb property is not defined in the constructor, but explicitly set by clients of this class !
> Then, I have a concrete subclass of that abstract class that implements Serializable, let's call it BuggyClass, eg :
> public class BuggyClass extends ANonSerializable implements Serializable {
> 	public BuggyClass() {
> 		super();
> 	}
> 	public void echo() {
> 		// Calls the parent method using
> 		System.out.println(getValue());
> 	}
> }
> Now, if we have a statefull page, which contains for example a form and which changes its structure on submit events (to cause a version change on each submit)
> containing an instance of BuggyClass and calling its echo() method in the onSubmit(), and that this page instance comes from the diskstore, a null pointer exception will be thrown, because the private field nb from the ANonSerializableClass won't have been restored properly
> I've attached a quickstart to this issue for more clarity ;)

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