Hi Werner, Could you tell me please where to download the testcase-archetype JAR ? When I run the command line mvn archetype:create -DarchetypeGroupId=org.codehaus.castor -DarchetypeArtifactId=testcase-archetype -DarchetypeVersion=1.0 ... as described on the Castor site ( http://castor.codehaus.org/maven-archetypes.html), an error occured because maven cannot find the artifact.
Thanks Eric 2008/4/14, Werner Guttmann <[EMAIL PROTECTED]>: > > Hi Eric, > > can you please create a new Jira issue at > > http://jira.codehaus.org/browse/CASTOR > > and attach all relevant artifacts such as mapping file, domain classes, > handler classes, JUnit test case. > > If you happen to be using Maven, you could use the Castor XML test case > archetype to get such a project created. > > Regards > Werner > > Eric Tournier wrote: > > > Hi ! > > I'm using a ConfigurableFieldHandler to format date attributes of java > > objects : > > public class Request > > private Date creationDate; > > private Certificate producedCertificate; > > > > public class Certificate > > private Date revocationDate; > > > > My mapping file is : > > <class name="Request" auto-complete="false" > > verify-constructable="false"> > > <map-to xml="request"/> > > <field name="creationDate" type="java.util.Date" > > handler="myDateFormatHandler"> > > <bind-xml name="creationDate" node="element"/> > > </field> > > <field name="producedCertificate" > > type="com.keynectis.sequoia.ra.core.domain.certificate.bean.CertificateBean"> > > <bind-xml name="certificate" node="element"/> > > </field> > > </class> > > <class name="Certificate" auto-complete="false" > > verify-constructable="false"> > > <map-to xml="certificate"/> > > <field name="revocationDate" type="java.util.Date" > > handler="myDateFormatHandler"> > > <bind-xml name="revocationDate" node="element"/> > > </field> > > </class> > > <field-handler name="myDateFormatHandler" class="DateFormatHandler"> > > <param name="date-format" value="yyyy/MM/dd"/> > > </field-handler> > > > > Unfortunately, the preceding (two identical handler declarations) leads > > to IllegalArgumentException : > > java.lang.IllegalArgumentException: object is not an instance of > > declaring class > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:585) > > at > > org.exolab.castor.mapping.loader.FieldHandlerImpl.getValue(FieldHandlerImpl.java:413) > > at > > org.exolab.castor.mapping.GeneralizedFieldHandler.getValue(GeneralizedFieldHandler.java:178) > > at > > org.exolab.castor.mapping.loader.FieldHandlerImpl.getValue(FieldHandlerImpl.java:387) > > at > > org.exolab.castor.xml.handlers.DateFieldHandler.getValue(DateFieldHandler.java:117) > > at > > org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:191) > > at > > org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:1065) > > at org.exolab.castor.xml.Validator.validate(Validator.java:135) > > at > > org.exolab.castor.xml.FieldValidator.validateInstance(FieldValidator.java:326) > > at > > org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:256) > > at > > org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:1065) > > at org.exolab.castor.xml.Validator.validate(Validator.java:135) > > at > > org.exolab.castor.xml.FieldValidator.validateInstance(FieldValidator.java:326) > > at > > org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:256) > > at > > org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:1065) > > at org.exolab.castor.xml.Validator.validate(Validator.java:135) > > at org.exolab.castor.xml.Marshaller.validate(Marshaller.java:2594) > > at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:826) > > > > If I add another fieldHandler like this : > > <field-handler name="anotherDateFormatHandler" > > class="DateFormatHandler"> > > <param name="date-format" value="yyyy/MM/dd"/> > > </field-handler> > > and if I replace one of the two handler declarations > > <field name="revocationDate" type="java.util.Date" > > handler="anotherDateFormatHandler"> > > for example, it works perfectly. > > > > Could someone explain me why ? > > Thanks in advance > > Eric > > > > > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > >

