[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-672) bug in ComponentType isModified method ClassCastException (dom4j)

Jason Clawson (JIRA) noreply at atlassian.com
Wed May 5 16:34:06 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-672?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=36923#action_36923 ] 

Jason Clawson commented on HHH-672:
-----------------------------------

Can someone please fix this issue.  It's been 5 years.... 5 YEARS guys, and a patch has been posted.  Its a very simple fix... Please fix this.  Thank you.

> bug in ComponentType isModified method ClassCastException (dom4j)
> -----------------------------------------------------------------
>
>                 Key: HHH-672
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-672
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.1 rc3
>         Environment: Hibernate 3.1 (stream), oracle 9.02
>            Reporter: Jessica Marchiori
>
> There is a bug with the EntityMode.DOM4j in class ComponentType method isModified. The association of oldValues causes a ClassCastException
> The original code was 
> public boolean isModified(Object old, Object current, SessionImplementor session)
> 			throws HibernateException {
> 		if ( current == null ) return old != null;
> 		if ( old == null ) return current != null;
> 		Object[] currentValues = getPropertyValues( current, session );
> 		Object[] oldValues  = ( Object[] ) old;
> 		}
> 		
> 		for ( int i = 0; i < currentValues.length; i++ ) {
> 			if ( propertyTypes[i].isModified( oldValues[i], currentValues[i], session ) ) {
> 				return true;
> 			}
> 		}
> 		return false;
> 	}
> I have changed the code as below 
> public boolean isModified(Object old, Object current, SessionImplementor session)
> 			throws HibernateException {
> 		if ( current == null ) return old != null;
> 		if ( old == null ) return current != null;
> 		Object[] currentValues = getPropertyValues( current, session );
> 		Object[] oldValues = getPropertyValues( old, session );
> 		
> 		for ( int i = 0; i < currentValues.length; i++ ) {
> 			if ( propertyTypes[i].isModified( oldValues[i], currentValues[i], session ) ) {
> 				return true;
> 			}
> 		}
> 		return false;
> 	}
> and it works

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