while ( orphanIter.hasNext() ) { Object orphan = orphanIter.next(); if (orphan!=null) { if ( log.isTraceEnabled() ) { log.trace("deleting orphaned entity instance: " + entityName); } eventSource.delete( entityName, orphan, false, new HashSet() ); } }
if ( !isInverse && collection.isRowUpdatePossible() ) { if ( log.isDebugEnabled() ) { log.debug( "Updating rows of collection: " + role + "#" + id ); } //update all the modified entries int count = doUpdateRows( id, collection, session ); if ( log.isDebugEnabled() ) { log.debug( "done updating rows: " + count + " updated" ); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/Cascade.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java
Method name: void deleteOrphans(String, PersistentCollection) Method name: void updateRows(PersistentCollection, Serializable, SessionImplementor)
Number of AST nodes: 6 Number of AST nodes: 6
1
while ( orphanIter.hasNext() ) {
2
			Object orphan = orphanIter.next();
3
			if (orphan!=null) {
1
if ( !isInverse && collection.isRowUpdatePossible() ) {
4
	
5
			if ( log.isTraceEnabled() ) {
2
			if ( log.isDebugEnabled() ) {
6
					log.trace("deleting orphaned entity instance: " + entityName);
3
				log.debug( "Updating rows of collection: " + role + "#" + id );
7
				}
4
			}
8
				eventSource.delete( entityName, orphan, false, new HashSet()
5
			//update all the modified entries
6
			int count = doUpdateRows( id, collection, session );
7
			if ( log.isDebugEnabled() ) {
9
 );
8
				log.debug( "done updating rows: " + count + " updated" );
10
			}
9
			}
11
		}
10
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are in different classes
Number of node comparisons6
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    10
    if (log.isTraceEnabled())
    10
    if (log.isTraceEnabled())
    2
    if (log.isDebugEnabled())
    Differences
    Expression1Expression2Difference
    isTraceEnabledisDebugEnabledMETHOD_INVOCATION_NAME_MISMATCH
    2
    if (log.isDebugEnabled())
    11
    log.trace("deleting orphaned entity instance: " + entityName);
    11
    log.trace("deleting orphaned entity instance: " + entityName);
    3
    log.debug("Updating rows of collection: " + role + "#" + id);
    Differences
    Expression1Expression2Difference
    "deleting orphaned entity instance: ""Updating rows of collection: "LITERAL_VALUE_MISMATCH
    entityNameroleVARIABLE_NAME_MISMATCH
    "deleting orphaned entity instance: " + entityName"Updating rows of collection: " + role + "#"+ idINFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    tracedebugMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression log.trace("deleting orphaned entity instance: " + entityName) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log.debug("Updating rows of collection: " + role + "#"+ id) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log.trace("deleting orphaned entity instance: " + entityName) is a void method call, and thus it cannot be parameterized
    Expression log.debug("Updating rows of collection: " + role + "#"+ id) is a void method call, and thus it cannot be parameterized
    3
    log.debug("Updating rows of collection: " + role + "#" + id);
    Precondition Violations (4)
    Row Violation
    1Expression log.trace("deleting orphaned entity instance: " + entityName) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression log.debug("Updating rows of collection: " + role + "#"+ id) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression log.trace("deleting orphaned entity instance: " + entityName) is a void method call, and thus it cannot be parameterized
    4Expression log.debug("Updating rows of collection: " + role + "#"+ id) is a void method call, and thus it cannot be parameterized