You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Howard Abrams (JIRA)" <de...@myfaces.apache.org> on 2005/11/21 11:52:43 UTC

[jira] Updated: (MYFACES-796) Problem with Date Conversion with 1.1.1 release

     [ http://issues.apache.org/jira/browse/MYFACES-796?page=all ]

Howard Abrams updated MYFACES-796:
----------------------------------

    Fix Version: 1.1.3

> Problem with Date Conversion with 1.1.1 release
> -----------------------------------------------
>
>          Key: MYFACES-796
>          URL: http://issues.apache.org/jira/browse/MYFACES-796
>      Project: MyFaces
>         Type: Bug
>   Components: Implementation, General
>     Versions: 1.1.1, Nightly
>  Environment: Windows XP SP2 Tomcat 5.5.9 MyFaces 1.1.1
>     Reporter: Rogerio Saulo
>     Priority: Critical
>      Fix For: 1.1.3

>
> When I upgrade from 1.1.0 to 1.1.1 my custom date converter stop working.
> In my page when the user does not fill the date field, that is not required myfaces report the following error, the field in backing bean is of type java.util.Date.
> Looking the source, I see the problem in class org.apache.myfaces.el.ValueBindingImpl , before 1.1.1, in the setValue(FacesContext facesContext, Object newValue) method, the call to the propertyResolver.setValue is in this way :
>                     Class clazz = propertyResolver.getType(base, property);
>                     propertyResolver.setValue(base, property, coerce(newValue, clazz));
> In the 1.1.1, this has changed to :
>                    propertyResolver.setValue(base, property, newValue);
> This change is causing the error.
> Follow my code that reproduces the error.
>  
> The Bean :
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>  
> public class UserSearchBean extends BaseSearchBean {
>  
>  private Integer id_user;
>  private String email;
>  private String login;
>  private String name;
>  private Date creation_timestamp1;
>  
>  public Date getCreation_timestamp1() {
>   return creation_timestamp1;
>  }
>  public void setCreation_timestamp1(Date creation_timestamp1) {
>   this.creation_timestamp1 = creation_timestamp1;
>  }
> ...
>  
> The Page :
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> <h:inputText id="txtDateCreation" value="#{UserSearchBean.creation_timestamp1}" maxlength="10" size="9" styleClass="input">
> <venus:dateTimeConverter pattern="DD/MM/YYYY" />
> </h:inputText>
> The Converter :
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>  public Object getAsObject(FacesContext context, UIComponent component, String newValue)
>    throws ConverterException {
>   
>   Date convertedValue = null;
>   
>   boolean valid = false;
>   if ( newValue == null || newValue.equals("") ) {
>    return newValue;
>   }  
>   SimpleDateFormat fmt = new SimpleDateFormat(pattern);
>   fmt.setLenient(false);
>   
>   try {
>    
>    convertedValue = fmt.parse(newValue);
>    valid = true;
>    
>   } catch (ParseException e) {
>   
>    valid = false;
>   }
>   
>   if ( !valid ) {
>    FacesMessage errMsg = MessageFactory.getMessage(context, DATETIME_FORMAT_INVALID_MESSAGE_ID, 
>     (new Object[] {newValue}));
>    throw new ConverterException(errMsg);
>   }
>   
>   return convertedValue;
>   
>  }
> The Error :
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>  
>  
> [2005-11-07 09:29:16,546] http-8080-Processor24 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/venusweb] ERROR - Cannot set value for expression '#{UserSearchBean.creation_timestamp1}' to a new value of type java.lang.String
> javax.faces.el.EvaluationException: Cannot set value for expression '#{UserSearchBean.creation_timestamp1}' to a new value of type java.lang.String
> at org.apache.myfaces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:304)
> at javax.faces.component.UIInput.updateModel(UIInput.java:226)
> at javax.faces.component.UIInput.processUpdates(UIInput.java:165)
> at javax.faces.component.UIForm.processUpdates(UIForm.java:85)
> at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:428)
> at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:153)
> at org.apache.myfaces.lifecycle.LifecycleImpl.updateModelValues(LifecycleImpl.java:277)
> at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:81)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at br.com.venus.view.filters.SecurityFilter.doFilter(SecurityFilter.java:61)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:172)
> at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
> at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> at java.lang.Thread.run(Thread.java:595)
> Caused by: javax.faces.el.EvaluationException: br.com.venus.model.bean.search.UserSearchBean
> at org.apache.myfaces.el.PropertyResolverImpl.setValue(PropertyResolverImpl.java:155)
> at org.apache.myfaces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:269)
> ... 32 more
> Caused by: javax.faces.el.EvaluationException: Bean: br.com.venus.model.bean.search.UserSearchBean, property: creation_timestamp1
> at org.apache.myfaces.el.PropertyResolverImpl.setProperty(PropertyResolverImpl.java:372)
> at org.apache.myfaces.el.PropertyResolverImpl.setValue(PropertyResolverImpl.java:148)
> ... 33 more
> Caused by: java.lang.IllegalArgumentException: argument type mismatch
> 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.apache.myfaces.el.PropertyResolverImpl.setProperty(PropertyResolverImpl.java:368)
> ... 34 more
> But I do not see this behavior with all prior version.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira