You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org> on 2008/03/19 22:08:29 UTC

[jira] Closed: (TAPESTRY-2123) ClassCastException in CoercingPropertyConduitWrapper

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

Howard M. Lewis Ship closed TAPESTRY-2123.
------------------------------------------

    Resolution: Invalid
      Assignee: Howard M. Lewis Ship

Thanks for verifying this.

Because the type of property testObject is TT1, that's the type that the BeanEditForm uses when instantiating the bean, and when generating the model (the two operations are tied together).  If you supply an explicit model to the BeanEditForm you can get the control you are looking for.

> ClassCastException in CoercingPropertyConduitWrapper
> ----------------------------------------------------
>
>                 Key: TAPESTRY-2123
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2123
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Core Components
>    Affects Versions: 5.0.9
>         Environment: Jetty & MacOS X 
>            Reporter: Moritz Gmelin
>            Assignee: Howard M. Lewis Ship
>
> When a bean editor receives beans from differenct classes (superclass & subclass) sometimes the wrong fields are displayed and other times a ClassCastException is throws in the CoercingPropertyConduitWrapper.
> This happens only, when bean editing is finished by the onSubmit method.
> TestCase: 
> TT1 is the superclasss of TT2
> TT1.java
> -------------------
> public class TT1 {
> 	private String name;
> 	
> 	public String getName() {
> 		return name;
> 	}
> 	
> 	public void setName(String name) {
> 		this.name = name;
> 	}
> }
> TT2.java
> ----------------------------
> public class TT2 extends TT1 {
> 	private String v2;
> 	public String getV2() {
> 		return v2;
> 	}
> 	public void setV2(String v2) {
> 		this.v2 = v2;
> 	}
> }
> CoercTest.java
> -----------------------
> public class CoercTest {
> 	@Persist
> 	private TT1 testObject;
> 	
> 	
> 	@OnEvent(component="typeTO1")
> 	public void onTypeTO1() {
> 		setTestObject(new TT1());
> 	}
> 	
> 	@OnEvent(component="typeTO2")
> 	public void onTypeTO2() {
> 		setTestObject(new TT2());		
> 	}
> 	public TT1 getTestObject() {
> 		return testObject;
> 	}
> 	public void setTestObject(TT1 testObject) {
> 		this.testObject = testObject;
> 	}
> 	
> 	public void onSubmit() {
> 		testObject = null;
> 	}
> 	
> 	public boolean isTestObjectNotNull() {
> 		return testObject != null;
> 	}
> 	
> }
> CoercTest.tml
> <html  xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <body>
> <t:ActionLink t:id="typeTO1">TT1</t:ActionLink><br/>
> <t:ActionLink t:id="typeTO2">TT2</t:ActionLink><br/>
> <t:If test="testObjectNotNull">
> <t:BeanEditForm object="testObject"/>
> </t:If>
> </body>
> </html>

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org