Hello all,
I just noticed something that I fail to explain. I'm using Eclipse / T5
/ Jetty plugin, just as in the tutorial, and developing a T5
application. I've been working on this configuration for quite some time
now, and it's my 3rd application developped with T5.
What I saw, is a difference of behavior of the application when I run it
"normally" and in "debug mode". In normal mode, my app runs fine, and in
debug mode, I've got a class cast exception on the following case.
I have a generic class associated with a form :
The class :
public abstract class MyObjectEditor<T> {
public abstract T getMyObject() ;
public abstract void setMyObject(T t) ;
public abstract String getExcludeList() ;
}
The TML :
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<t:form t:id="myobjecteditor">
<t:errors/>
<t:beaneditor t:id="myobject" t:exclude="prop:excludelist"/>
<t:submit t:value="message:submit-label"/>
</t:form>
</t:container>
Of course the abstract class is extended by concrete classes, let's say
this one (a simplified version, there's not everything in it) :
public class AbstractSomeObjectEditor extends MyObjectEditor<SomeObject> {
private SomeObject someObject ;
@OnEvent(component="myobjecteditor",value="success")
ResultPage createMyObject() {
boolean created = objectService.createObject(getMyObject()) ;
if (created) {
resultPage.setMessage(messages.get("object-created")) ;
} else {
resultPage.setMessage(messages.get("object-not-created")) ;
}
return resultPage ;
}
@Override
public SomeObject getMyObject() {
return someObject ;
}
@Override
public void setMyObject(SomeObject someObject) {
this.someObject = someObject ;
}
@Override
public String getExcludeList() {
return "id, creationDate, lastRevisionDate" ;
}
}
In normal mode, everything runs flawlessly. In debug mode I have the
following exception :
location
classpath:org.mycomp.mywebapp.components.AbstractSomeObjectEditor.MyObjectEditor.tml,
line 10, column 65 (this is the place where the beaneditor is)
java.lang.ClassCastException
java.lang.Object
#
org.mycomp.mywebapp.components.AbstractSomeObjectEditor.setMyObject(AbstractSomeObjectEditor.java:1)
#
org.apache.tapestry5.internal.bindings.PropBinding.set(PropBinding.java:66)
#
org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.writeParameter(InternalComponentResourcesImpl.java:273)
#
org.apache.tapestry5.corelib.components.BeanEditor._$update_parameter_object(BeanEditor.java)
#
org.apache.tapestry5.corelib.components.BeanEditor.doPrepare(BeanEditor.java:162)
#
org.apache.tapestry5.corelib.components.BeanEditor$Prepare.execute(BeanEditor.java:47)
#
org.apache.tapestry5.corelib.components.BeanEditor$Prepare.execute(BeanEditor.java:41)
#
org.apache.tapestry5.corelib.internal.FormSupportImpl.storeAndExecute(FormSupportImpl.java:98)
#
org.apache.tapestry5.corelib.components.BeanEditor.setupRender(BeanEditor.java:141)
#
org.apache.tapestry5.corelib.components.BeanEditor.setupRender(BeanEditor.java)
#
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$13$1.run(ComponentPageElementImpl.java:475)
#
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:895)
#
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$100(ComponentPageElementImpl.java:50)
#
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$13.render(ComponentPageElementImpl.java:479)
#
org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:68)
#
org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:108)
Any thoughts would be much appreciated,
José
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]