if ( sessionFactory != null ) { sessionFactory.close(); sessionFactory = null; } configuration = null;
if ( child != null ) { children.add( child ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testing/src/main/java/org/hibernate/junit/functional/ExecutionEnvironment.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/event/collection/AbstractParentWithCollection.java
Method name: void complete() Method name: void addChild(Child)
Number of AST nodes: 4 Number of AST nodes: 2
1
if ( sessionFactory != null ) {
1
if ( child != null ) {
2
			sessionFactory.close();
2
			
3
			sessionFactory = null;
4
		}
5
		configuration = null;
3
children.add( child );
4
		}
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 different classes
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (sessionFactory != null)
    1
    if (sessionFactory != null)
    1
    if (child != null)
    Differences
    Expression1Expression2Difference
    sessionFactorychildVARIABLE_NAME_MISMATCH
    org.hibernate.SessionFactoryorg.hibernate.test.event.collection.ChildVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.SessionFactory of variable sessionFactory does not match with type org.hibernate.test.event.collection.Child of variable child
    • Make classes org.hibernate.SessionFactory and org.hibernate.test.event.collection.Child extend a common superclass
    1
    if (child != null)
                                                  
    2
    children.add(child);
    2
    sessionFactory.close();
                                                        
    3
    sessionFactory = null;
                                                  
    4
    configuration = null;
                                                
    Precondition Violations (1)
    Row Violation
    1Type org.hibernate.SessionFactory of variable sessionFactory does not match with type org.hibernate.test.event.collection.Child of variable child