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

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


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


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