You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Duto (JIRA)" <ji...@apache.org> on 2012/08/03 10:03:03 UTC

[jira] [Created] (WICKET-4694) ClassCastException in SqlDateConverter

Duto created WICKET-4694:
----------------------------

             Summary: ClassCastException in SqlDateConverter
                 Key: WICKET-4694
                 URL: https://issues.apache.org/jira/browse/WICKET-4694
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5.7
         Environment: Windows  7x64, jdk1.6.0_33 (32bits)
            Reporter: Duto


When converting a date string to a java.sql.Date you'll always get a ClassCastException like this one:

java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date
     at org.apache.wicket.util.convert.converters.SqlDateConverter.convertToObject(SqlDateConverter.java:43)

Reason is DateFormat.parse() returns a java.util.Date, which is cast to java.sql.Date. One solution would be

return new Date(((java.util.Date)parse(getDateFormat(locale), value, locale)).getTime())

See https://issues.apache.org/jira/browse/WICKET-2309

The problem had been fixed in version 1.4, but the (java.util.Date) code was remove on 1.5 and It's very important to don't have this error.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (WICKET-4694) ClassCastException in SqlDateConverter

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-4694.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5.8
                   6.0.0
         Assignee: Martin Grigorov
    
> ClassCastException in SqlDateConverter
> --------------------------------------
>
>                 Key: WICKET-4694
>                 URL: https://issues.apache.org/jira/browse/WICKET-4694
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.7
>         Environment: Windows  7x64, jdk1.6.0_33 (32bits)
>            Reporter: Duto
>            Assignee: Martin Grigorov
>              Labels: (java.util.Date), 1.5, ClassCastException, SqlDateConverter
>             Fix For: 6.0.0, 1.5.8
>
>
> When converting a date string to a java.sql.Date you'll always get a ClassCastException like this one:
> java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date
>      at org.apache.wicket.util.convert.converters.SqlDateConverter.convertToObject(SqlDateConverter.java:43)
> Reason is DateFormat.parse() returns a java.util.Date, which is cast to java.sql.Date. One solution would be
> return new Date(((java.util.Date)parse(getDateFormat(locale), value, locale)).getTime())
> See https://issues.apache.org/jira/browse/WICKET-2309
> The problem had been fixed in version 1.4, but the (java.util.Date) code was remove on 1.5 but It's very important to don't have this error.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-4694) ClassCastException in SqlDateConverter

Posted by "Duto (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Duto updated WICKET-4694:
-------------------------

    Description: 
When converting a date string to a java.sql.Date you'll always get a ClassCastException like this one:

java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date
     at org.apache.wicket.util.convert.converters.SqlDateConverter.convertToObject(SqlDateConverter.java:43)

Reason is DateFormat.parse() returns a java.util.Date, which is cast to java.sql.Date. One solution would be

return new Date(((java.util.Date)parse(getDateFormat(locale), value, locale)).getTime())

See https://issues.apache.org/jira/browse/WICKET-2309

The problem had been fixed in version 1.4, but the (java.util.Date) code was remove on 1.5 but It's very important to don't have this error.

  was:
When converting a date string to a java.sql.Date you'll always get a ClassCastException like this one:

java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date
     at org.apache.wicket.util.convert.converters.SqlDateConverter.convertToObject(SqlDateConverter.java:43)

Reason is DateFormat.parse() returns a java.util.Date, which is cast to java.sql.Date. One solution would be

return new Date(((java.util.Date)parse(getDateFormat(locale), value, locale)).getTime())

See https://issues.apache.org/jira/browse/WICKET-2309

The problem had been fixed in version 1.4, but the (java.util.Date) code was remove on 1.5 and It's very important to don't have this error.

    
> ClassCastException in SqlDateConverter
> --------------------------------------
>
>                 Key: WICKET-4694
>                 URL: https://issues.apache.org/jira/browse/WICKET-4694
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.7
>         Environment: Windows  7x64, jdk1.6.0_33 (32bits)
>            Reporter: Duto
>              Labels: (java.util.Date), 1.5, ClassCastException, SqlDateConverter
>
> When converting a date string to a java.sql.Date you'll always get a ClassCastException like this one:
> java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date
>      at org.apache.wicket.util.convert.converters.SqlDateConverter.convertToObject(SqlDateConverter.java:43)
> Reason is DateFormat.parse() returns a java.util.Date, which is cast to java.sql.Date. One solution would be
> return new Date(((java.util.Date)parse(getDateFormat(locale), value, locale)).getTime())
> See https://issues.apache.org/jira/browse/WICKET-2309
> The problem had been fixed in version 1.4, but the (java.util.Date) code was remove on 1.5 but It's very important to don't have this error.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4694) ClassCastException in SqlDateConverter

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13428113#comment-13428113 ] 

Sven Meier commented on WICKET-4694:
------------------------------------

This is the current line 43 in wicket-1.5.x:

  return new Date(parse(getDateFormat(locale), value, locale).getTime());

Looks pretty much the same what you're suggesting and hasn't changed for the last two years.
                
> ClassCastException in SqlDateConverter
> --------------------------------------
>
>                 Key: WICKET-4694
>                 URL: https://issues.apache.org/jira/browse/WICKET-4694
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.7
>         Environment: Windows  7x64, jdk1.6.0_33 (32bits)
>            Reporter: Duto
>              Labels: (java.util.Date), 1.5, ClassCastException, SqlDateConverter
>
> When converting a date string to a java.sql.Date you'll always get a ClassCastException like this one:
> java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date
>      at org.apache.wicket.util.convert.converters.SqlDateConverter.convertToObject(SqlDateConverter.java:43)
> Reason is DateFormat.parse() returns a java.util.Date, which is cast to java.sql.Date. One solution would be
> return new Date(((java.util.Date)parse(getDateFormat(locale), value, locale)).getTime())
> See https://issues.apache.org/jira/browse/WICKET-2309
> The problem had been fixed in version 1.4, but the (java.util.Date) code was remove on 1.5 but It's very important to don't have this error.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4694) ClassCastException in SqlDateConverter

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13429062#comment-13429062 ] 

Martin Grigorov commented on WICKET-4694:
-----------------------------------------

The problem is in the class type signature: SqlDateConverter extends AbstractConverter<java.sql.Date> and later usage of #parse() method which tries to cast java.util.Date to java.sql.Date.
                
> ClassCastException in SqlDateConverter
> --------------------------------------
>
>                 Key: WICKET-4694
>                 URL: https://issues.apache.org/jira/browse/WICKET-4694
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.7
>         Environment: Windows  7x64, jdk1.6.0_33 (32bits)
>            Reporter: Duto
>              Labels: (java.util.Date), 1.5, ClassCastException, SqlDateConverter
>
> When converting a date string to a java.sql.Date you'll always get a ClassCastException like this one:
> java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date
>      at org.apache.wicket.util.convert.converters.SqlDateConverter.convertToObject(SqlDateConverter.java:43)
> Reason is DateFormat.parse() returns a java.util.Date, which is cast to java.sql.Date. One solution would be
> return new Date(((java.util.Date)parse(getDateFormat(locale), value, locale)).getTime())
> See https://issues.apache.org/jira/browse/WICKET-2309
> The problem had been fixed in version 1.4, but the (java.util.Date) code was remove on 1.5 but It's very important to don't have this error.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira