[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-2325) Exception handling in NullableType - NullPointerException

Steve Ebersole (JIRA) noreply at atlassian.com
Thu Jan 11 07:58:44 EST 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2325?page=all ]
     
Steve Ebersole resolved HHH-2325:
---------------------------------

    Resolution: Rejected

It is fixed.  The code is the same on trunk as well as the 3.1 and 3.2 branches and looks like:


	public final void nullSafeSet(PreparedStatement st, Object value, int index)
	throws HibernateException, SQLException {
		try {
			if ( value == null ) {
				if ( IS_TRACE_ENABLED ) {
					log().trace( "binding null to parameter: " + index );
				}

				st.setNull( index, sqlType() );
			}
			else {
				if ( IS_TRACE_ENABLED ) {
					log().trace( "binding '" + toString( value ) + "' to parameter: " + index );
				}

				set( st, value, index );
			}
		}
		catch ( RuntimeException re ) {
			log().info( "could not bind value '" + toString( value ) + "' to parameter: " + index + "; " + re.getMessage() );
			throw re;
		}
		catch ( SQLException se ) {
			log().info( "could not bind value '" + toString( value ) + "' to parameter: " + index + "; " + se.getMessage() );
			throw se;
		}
	}

> Exception handling in NullableType - NullPointerException
> ---------------------------------------------------------
>
>          Key: HHH-2325
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2325
>      Project: Hibernate3
>         Type: Bug

>   Components: core
>     Versions: 3.1.2
>     Reporter: Krzysztof Adamski
>     Assignee: Steve Ebersole
>     Priority: Critical
>      Fix For: 3.1.3, 3.2.0 cr1

>
>
> I think the exception handling in nullabletype is broken/non-aligned.
> in nullsafeset:
> catch (RuntimeException re) {
> 			LogFactory.getLog( getClass() ).info(
> 					"could not bind value '" + toString(value) + 
> 					"' to parameter: " + index
> 				);
> 		}
> notice that there are no throw re; here. meaning an exception can occur but the code will just continue.
> AND RuntimeException is catched instead of Throwable meaning SQLException's which is the most likely exception will not result in a logging.

-- 
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