[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-672) bug in ComponentType isModified method ClassCastException (dom4j)
Gail Badner (JIRA)
noreply at atlassian.com
Wed May 5 16:50:06 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-672?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=36924#action_36924 ]
Gail Badner commented on HHH-672:
---------------------------------
Please do the following:
* svn co http://anonsvn.jboss.org/repos/hibernate/core/trunk/
* update an existing test or add a new test to testsuite/src/test/java/org/hibernate/test/component
* attach a patch with the updated/added unit test using svn diff
* attach a patch with your fix using svn diff
Thanks,
Gail
> 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