You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Moritz Gmelin (JIRA)" <de...@tapestry.apache.org> on 2008/02/04 23:01:15 UTC

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

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


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


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

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
     [ 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


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

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574054#action_12574054 ] 

Howard M. Lewis Ship commented on TAPESTRY-2123:
------------------------------------------------

I suspect that TAPESTRY-2022 may have incidentally fixed this bug.  Any chance you can verify against latest snapshots (after the next nightly build).

> 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
>
> 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


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

Posted by "Moritz Gmelin (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574368#action_12574368 ] 

Moritz Gmelin commented on TAPESTRY-2123:
-----------------------------------------

Sorry for responding so late. I just tried with 5.0.11-SNAPSHOT but I get 

Caused by: java.lang.NoClassDefFoundError: org/apache/tapestry/beaneditor/RelativePosition

With that simple example

> 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
>
> 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


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

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12579954#action_12579954 ] 

Howard M. Lewis Ship commented on TAPESTRY-2123:
------------------------------------------------

Make sure you are picking up the correct version of tapestry-annotations.jar as well.

> 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
>
> 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


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

Posted by "Moritz Gmelin (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12580260#action_12580260 ] 

Moritz Gmelin commented on TAPESTRY-2123:
-----------------------------------------

5.0.11 fixes the issue. Although now, the BeanEditor only displays the fields of TT1. Never those of TT2 even if the bean to edit is TT2. I think this is expected from you but not what I had hoped 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
>
> 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