[ 
https://issues.apache.org/jira/browse/WICKET-4731?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Emond Papegaaij updated WICKET-4731:
------------------------------------

    Fix Version/s:     (was: 6.0.1)
                   6.1.0
    
> TimeField not able to work with a java.sql.Time
> -----------------------------------------------
>
>                 Key: WICKET-4731
>                 URL: https://issues.apache.org/jira/browse/WICKET-4731
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 1.5.8
>         Environment: Ubuntu 10.04, Wicket 1.5 Snapshot, Open JDK 1.6
>            Reporter: Shu
>            Assignee: Martin Grigorov
>            Priority: Minor
>             Fix For: 6.1.0, 1.5.9
>
>
> When using the TimeField with a model whose object is a java.sql.Time, I get 
> an error similar to the following when submitting the form:
> Last cause: Cannot parse '1/1/70' using format 
> java.text.SimpleDateFormat@b4dc7db3
> Here's how the TimeField is constructed:
> TimeField tf = new TimeField(id, new Model<java.sql.Time>() {
> public java.sql.Time getObject() {
> // return java.sql.Time
> }
> });
> This error is occurring because SqlTimeConverter is trying to convert the 
> string representation of the java.util.Date obtained from the TimeField. 
> TimeField doesn't support anything other than java.util.Date. It would be 
> useful if TimeField could work with subclasses of java.util.Date such as 
> java.sql.Time. In order to achieve this, I would like to propose:
> Changing setConvertedInput(new Date(date.getMillis())); in 
> DateTimeField.convertInput() to 
> setConvertedInput(newDateInstance(date.getMillis()));
> Create an overridable newDateInstance(long) method. Users of TimeField can 
> override this method to create a java.sql.Time instance instead of a 
> java.util.Date. The form component conversion process will then work when the 
> model object is a java.sql.Time.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to