[richfaces-issues] [JBoss JIRA] Resolved: (RF-8173) Regression: Calendar: converter is not working

Alex Kolonitsky (JIRA) jira-events at lists.jboss.org
Mon Dec 14 05:20:31 EST 2009


     [ https://jira.jboss.org/jira/browse/RF-8173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Kolonitsky resolved RF-8173.
---------------------------------

    Resolution: Cannot Reproduce Bug


Your code isn't working fine, you have different formats for date:
for calendar - datePattern="dd/MM/yyyy"
for localDate are using default date format - (yyyy-MM-dd)

1428    //-----------------------------------------------------------------------
1429 /**
1430     * Output the date time in ISO8601 format (yyyy-MM-dd).
1431     *
1432     * @return ISO8601 time formatted string.
1433     */
1434    public String JavaDoc toString() {
1435        return ISODateTimeFormat.date().print(this);
1436    }

if you change your converter like 

    public String getAsString( final FacesContext facesContext, final UIComponent uiComponent, final Object obj ) {
        ...

        LocalDate date = (LocalDate) obj;
        return date.getDayOfMonth() + "/" + date.getMonthOfYear() + "/" + date.getYear();
    }

it will work fine.

If getAsString for your converter really are not invoking, looking for mistake in your environment setup (for example seam configuration).

Please next time remove all .svn dirs from your project and don't use absolute path in idea project setting. I can't successfully assembly project by the idea, maven, ant.


> Regression: Calendar: converter is not working
> ----------------------------------------------
>
>                 Key: RF-8173
>                 URL: https://jira.jboss.org/jira/browse/RF-8173
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-input, regression
>    Affects Versions: 3.3.2.SR1
>         Environment: JBoss 5.0 / Seam 2.1.2.GA
>            Reporter: Joseph Miller
>            Assignee: Alex Kolonitsky
>             Fix For: 3.3.3.BETA1
>
>
> I have a model property with is a Joda LocalDate. For normal input fields, I have a converter, which is working fine. However, when I try to use the converter with rich:calendar, it complains:
>             <rich:calendar id="from" locale="AU" showApplyButton="false" popup="true"
>                            enableManualInput="true" datePattern="dd/MM/yyyy"
>                            value="#{adviserAvailability.validFrom}">
>                 <f:converter converterId="localDateConverter" />
>             </rich:calendar>
> javax.faces.convert.ConverterException: Value must be a date
> 	at javax.faces.convert.DateTimeConverter.getAsObject(DateTimeConverter.java:401)
> 	at org.richfaces.component.UICalendar.getAsDate(UICalendar.java:399)
> 	at org.richfaces.component.UICalendar.getAsDate(UICalendar.java:410)
> 	at org.richfaces.component.UICalendar.getCurrentDateOrDefault(UICalendar.java:374)
> 	at org.richfaces.renderkit.html.CalendarRenderer.doEncodeEnd(CalendarRenderer.java:381)
> 	at org.richfaces.renderkit.html.CalendarRenderer.doEncodeEnd(CalendarRenderer.java:531)
> 	at org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:134)
> 	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861)
> ...
> I'm defining the converter as such:
> @Name( "localDateConverter" )
> @BypassInterceptors
> @Converter( forClass = LocalDate.class, id = "localDateConverter")
> public class LocalDateConverter
>         implements javax.faces.convert.Converter {
>   public Object getAsObject( ... )  { .... }
>   public String getAsString( ... )  { .... }
> }
> If I turn the property into a Date by using: value="#{adviserAvailability.validFrom.toDateMidnight().toDate()}"
> I get a conversion error, as I would expect from with LocalDateConverter.getAsObject, so it's definitely being made available.
> I get the same issue regardless of if I use <f:converter> or the converter attribute of <rich:calendar>

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

        


More information about the richfaces-issues mailing list