Hi,
A few weeks ago someone had this problem with the validation of a form
with a date field. I am now experiencing the same problem.
My Setup :
- class Account with two java.util.Date fields.
- metadata class :
public class AccountMetaData extends MetaData {
private static final Format DATEF = new
SimpleDateFormat("yyyy/MM/dd");
public void activateMetaData() {
String userTable = RifeConfig.Authentication.getTableUser();
addConstraint(new
ConstrainedProperty("id").identifier(true).editable(
false));
addConstraint(new ConstrainedProperty("rifeUserId").notNull(true)
.manyToOne(userTable, "userid"));
addConstraint(new ConstrainedProperty("email").notNull(true)
.email(true).maxLength(100));
addConstraint(new
ConstrainedProperty("active").notNull(true).defaultValue(true));
addConstraint(new
ConstrainedProperty("startSubscription").notNull(true).format(DATEF));
addConstraint(new
ConstrainedProperty("stopSubscription").notNull(true).format(DATEF));
}
}
In my element : I call the 'generateForm(template,account);' method
(Account account = getSubmissionBean(Account.class);).
This is the stacktrace :
SEVERE: Error on host localhost:8080/
com.uwyn.rife.engine.exceptions.EngineException:
java.lang.IllegalArgumentException: Cannot format given Object as a Date
at
com.uwyn.rife.engine.ElementContext.processContext(ElementContext.java:464)
at com.uwyn.rife.engine.RequestState.service(RequestState.java:350)
at com.uwyn.rife.engine.Gate.handleRequest(Gate.java:421)
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 com.uwyn.rife.servlet.RifeFilter.doFilter(RifeFilter.java:142)
at
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:823)
at
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:473)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
at
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:635)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
at org.mortbay.http.HttpServer.service(HttpServer.java:954)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)
at
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)
at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: java.lang.IllegalArgumentException: Cannot format given
Object as a Date
at java.text.DateFormat.format(DateFormat.java:279)
at java.text.Format.format(Format.java:133)
at
com.uwyn.rife.tools.BeanUtils.formatPropertyValue(BeanUtils.java:486)
at
com.uwyn.rife.tools.ArrayUtils.createStringArray(ArrayUtils.java:115)
at
com.uwyn.rife.site.FormBuilderXhtml.generateForm(FormBuilderXhtml.java:155)
at
com.uwyn.rife.site.FormBuilderXhtml.generateForm(FormBuilderXhtml.java:65)
at
com.uwyn.rife.engine.ElementContext.generateForm(ElementContext.java:3100)
at
com.uwyn.rife.engine.ElementSupport.generateForm(ElementSupport.java:4827)
at
com.uwyn.rife.engine.ElementSupport.generateForm(ElementSupport.java:4795)
at
be.kmi_irm.labo.web.rife.elements.admin.CustomerEdit.doCustomer(CustomerEdit.java:99)
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
com.uwyn.rife.engine.ElementContext.processContext(ElementContext.java:450)
... 20 more
What can this be ?
Henk
--_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users