Iterator itr = collectionLoadContexts.values().iterator(); while ( itr.hasNext() ) { CollectionLoadContext collectionLoadContext = ( CollectionLoadContext ) itr.next(); log.warn( "fail-safe cleanup (collections) : " + collectionLoadContext ); collectionLoadContext.cleanup(); } collectionLoadContexts.clear();
Iterator itr = entityLoadContexts.values().iterator(); while ( itr.hasNext() ) { EntityLoadContext entityLoadContext = ( EntityLoadContext ) itr.next(); log.warn( "fail-safe cleanup (entities) : " + entityLoadContext ); entityLoadContext.cleanup(); } entityLoadContexts.clear();
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/loading/LoadContexts.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/loading/LoadContexts.java
Method name: void cleanup() Method name: void cleanup()
Number of AST nodes: 6 Number of AST nodes: 6
1
Iterator itr = collectionLoadContexts.values().iterator();
1
Iterator itr = entityLoadContexts.values().iterator();
2
			while ( itr.hasNext() ) {
2
			while ( itr.hasNext() ) {
3
				CollectionLoadContext collectionLoadContext = ( CollectionLoadContext ) itr.next();
3
				EntityLoadContext entityLoadContext = ( EntityLoadContext ) itr.next();
4
				log.warn( "fail-safe cleanup (collections) : " + collectionLoadContext );
4
				log.warn( "fail-safe cleanup (entities) : " + entityLoadContext );
5
				collectionLoadContext.cleanup();
5
				entityLoadContext.cleanup();
6
			}
6
			}
7
			collectionLoadContexts.clear();
7
			entityLoadContexts.clear();
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.1
Clones locationClones are in the same method
Number of node comparisons21
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    Iterator itr = collectionLoadContexts.values().iterator();
    2
    Iterator itr = collectionLoadContexts.values().iterator();
    9
    Iterator itr = entityLoadContexts.values().iterator();
    Differences
    Expression1Expression2Difference
    collectionLoadContextsentityLoadContextsVARIABLE_NAME_MISMATCH
    9
    Iterator itr = entityLoadContexts.values().iterator();
    3
    while (itr.hasNext())
    10
    while (itr.hasNext())
    4
    CollectionLoadContext collectionLoadContext = (CollectionLoadContext)itr.next();
    4
    CollectionLoadContext collectionLoadContext = (CollectionLoadContext)itr.next();
    Preondition Violations
    Unmatched statement CollectionLoadContext collectionLoadContext=(CollectionLoadContext)itr.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                      
    5
    log.warn("fail-safe cleanup (collections) : " + collectionLoadContext);
                                                                                                                                                        
                                                                                                                                                
    11
    EntityLoadContext entityLoadContext = (EntityLoadContext)itr.next();
    Preondition Violations
    Unmatched statement EntityLoadContext entityLoadContext=(EntityLoadContext)itr.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11
    EntityLoadContext entityLoadContext = (EntityLoadContext)itr.next();
                                                                                                                                            
    12
    log.warn("fail-safe cleanup (entities) : " + entityLoadContext);
    6
    collectionLoadContext.cleanup();
    6
    collectionLoadContext.cleanup();
    13
    entityLoadContext.cleanup();
    Differences
    Expression1Expression2Difference
    collectionLoadContextentityLoadContextVARIABLE_NAME_MISMATCH
    org.hibernate.engine.loading.CollectionLoadContextorg.hibernate.engine.loading.EntityLoadContextVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.engine.loading.CollectionLoadContext of variable collectionLoadContext does not match with type org.hibernate.engine.loading.EntityLoadContext of variable entityLoadContext
    • Make classes org.hibernate.engine.loading.CollectionLoadContext and org.hibernate.engine.loading.EntityLoadContext extend a common superclass
    13
    entityLoadContext.cleanup();
    7
    collectionLoadContexts.clear();
    7
    collectionLoadContexts.clear();
    14
    entityLoadContexts.clear();
    Differences
    Expression1Expression2Difference
    collectionLoadContextsentityLoadContextsVARIABLE_NAME_MISMATCH
    14
    entityLoadContexts.clear();
    Precondition Violations (3)
    Row Violation
    1Unmatched statement CollectionLoadContext collectionLoadContext=(CollectionLoadContext)itr.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement EntityLoadContext entityLoadContext=(EntityLoadContext)itr.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.hibernate.engine.loading.CollectionLoadContext of variable collectionLoadContext does not match with type org.hibernate.engine.loading.EntityLoadContext of variable entityLoadContext