[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2034) Potential ClassCastException in catch block in NullableType

Øyvind Roth (JIRA) noreply at atlassian.com
Wed Mar 14 06:31:09 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2034?page=comments#action_26454 ] 

Øyvind Roth commented on HHH-2034:
----------------------------------

See also  HHH-2490

> Potential ClassCastException in catch block in NullableType
> -----------------------------------------------------------
>
>          Key: HHH-2034
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2034
>      Project: Hibernate3
>         Type: Improvement

>   Components: core
>     Versions: 3.1.3
>  Environment: Hibernate 3.1.3
>     Reporter: Galen Palmer
>     Priority: Minor

>
> Original Estimate: 1 hour
>         Remaining: 1 hour
>
> It is possible to throw an exception from within the catch block of NullableType.nullSafeSet() since the toString(value) method calls in many cases (e.g. StringType) simply result in a cast of return (String)value.  This may mask the underlying problem for the users.
> A proposed solution would be to replace the call in the catch blog of toString(value) with a reference to value.  For example:
> line 87: 
> log().info( "could not bind value '" + value + "' to parameter: " + index + "; " + re.getMessage() );
> and line 91:
> log().info( "could not bind value '" + value + "' to parameter: " + index + "; " + se.getMessage() );
> This change would prevent the catch block from throwing the exception.

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





More information about the hibernate-issues mailing list