final Object entity = source.getPersistenceContext().unproxyAndReassociate( object ); event.setEntity( entity ); event.setEntry( source.getPersistenceContext().getEntry( entity ) ); //return the id in the event object event.setResultId( performSaveOrUpdate( event ) );
while ( iter.hasNext() ) { cols.clear(); Join join = (Join) iter.next(); checkColumnDuplication( cols, join.getKey().getColumnIterator() ); checkPropertyColumnDuplication( cols, join.getPropertyIterator() ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/event/def/DefaultSaveOrUpdateEventListener.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/PersistentClass.java
Method name: void onSaveOrUpdate(SaveOrUpdateEvent) Method name: void checkColumnDuplication()
Number of AST nodes: 4 Number of AST nodes: 5
1
final Object entity = source.getPersistenceContext().unproxyAndReassociate( object );
2
			event.setEntity( entity );
3
			event.setEntry( source.getPersistenceContext().getEntry( entity ) );
4
			//return the id in the event object
5
			event.setResultId( performSaveOrUpdate( event ) );
1
while ( iter.hasNext() ) {
2
			cols.clear();
3
			Join join = (Join) iter.next();
4
			checkColumnDuplication( cols, join.getKey().getColumnIterator() );
5
			checkPropertyColumnDuplication( cols, join.getPropertyIterator() );
6
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in different classes
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                    
    8
    cols.clear();
                                                                  
    9
    Join join = (Join)iter.next();
    Preondition Violations
    Unmatched statement Join join=(Join)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    Join join = (Join)iter.next();
    9
    final Object entity = source.getPersistenceContext().unproxyAndReassociate(object);
                                                                                                                                                                            
    10
    event.setEntity(entity);
    10
    event.setEntity(entity);
    10
    checkColumnDuplication(cols, join.getKey().getColumnIterator());
    Differences
    Expression1Expression2Difference
    setEntitycheckColumnDuplicationMETHOD_INVOCATION_NAME_MISMATCH
    event.setEntity(entity)checkColumnDuplication(cols,join.getKey().getColumnIterator())ARGUMENT_NUMBER_MISMATCH
    eventMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression event.setEntity(entity) is a void method call, and thus it cannot be parameterized
    Expression checkColumnDuplication(cols,join.getKey().getColumnIterator()) is a void method call, and thus it cannot be parameterized
    Expression event.setEntity(entity) is a void method call, and thus it cannot be parameterized
    Expression checkColumnDuplication(cols,join.getKey().getColumnIterator()) is a void method call, and thus it cannot be parameterized
    10
    checkColumnDuplication(cols, join.getKey().getColumnIterator());
    11
    event.setEntry(source.getPersistenceContext().getEntry(entity));
    11
    event.setEntry(source.getPersistenceContext().getEntry(entity));
    11
    checkPropertyColumnDuplication(cols, join.getPropertyIterator());
    Differences
    Expression1Expression2Difference
    setEntrycheckPropertyColumnDuplicationMETHOD_INVOCATION_NAME_MISMATCH
    event.setEntry(source.getPersistenceContext().getEntry(entity))checkPropertyColumnDuplication(cols,join.getPropertyIterator())ARGUMENT_NUMBER_MISMATCH
    eventMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression event.setEntry(source.getPersistenceContext().getEntry(entity)) is a void method call, and thus it cannot be parameterized
    Expression checkPropertyColumnDuplication(cols,join.getPropertyIterator()) is a void method call, and thus it cannot be parameterized
    Expression event.setEntry(source.getPersistenceContext().getEntry(entity)) is a void method call, and thus it cannot be parameterized
    Expression checkPropertyColumnDuplication(cols,join.getPropertyIterator()) is a void method call, and thus it cannot be parameterized
    11
    checkPropertyColumnDuplication(cols, join.getPropertyIterator());
    12
    event.setResultId(performSaveOrUpdate(event));
    12
    event.setResultId(performSaveOrUpdate(event));
    Preondition Violations
    Unmatched statement event.setResultId(performSaveOrUpdate(event)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                        
    Precondition Violations (10)
    Row Violation
    1Unmatched statement Join join=(Join)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression event.setEntity(entity) is a void method call, and thus it cannot be parameterized
    3Expression checkColumnDuplication(cols,join.getKey().getColumnIterator()) is a void method call, and thus it cannot be parameterized
    4Expression event.setEntity(entity) is a void method call, and thus it cannot be parameterized
    5Expression checkColumnDuplication(cols,join.getKey().getColumnIterator()) is a void method call, and thus it cannot be parameterized
    6Expression event.setEntry(source.getPersistenceContext().getEntry(entity)) is a void method call, and thus it cannot be parameterized
    7Expression checkPropertyColumnDuplication(cols,join.getPropertyIterator()) is a void method call, and thus it cannot be parameterized
    8Expression event.setEntry(source.getPersistenceContext().getEntry(entity)) is a void method call, and thus it cannot be parameterized
    9Expression checkPropertyColumnDuplication(cols,join.getPropertyIterator()) is a void method call, and thus it cannot be parameterized
    10Unmatched statement event.setResultId(performSaveOrUpdate(event)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted