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

Galen Palmer (JIRA) noreply at atlassian.com
Mon Aug 28 17:36:24 EDT 2006


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

Galen Palmer commented on HHH-2034:
-----------------------------------

I think with this change, the ClassCastException exception would have thrown from within the "set" method of StringType potentially giving me more information on the context of the problem.

(I still haven't solved the underlying problem, but that's OT here...)

> 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