if (cache!=null) { cache.stop(); cache.destroy(); cache=null; }
if ( sessionFactory != null ) { sessionFactory.close(); sessionFactory = null; } configuration = null;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache/src/main/java/org/hibernate/cache/TreeCacheProvider.java File path: /hibernate-distribution-3.3.2.GA/project/testing/src/main/java/org/hibernate/junit/functional/ExecutionEnvironment.java
Method name: void stop() Method name: void complete()
Number of AST nodes: 4 Number of AST nodes: 4
1
if (cache!=null) {
1
if ( sessionFactory != null ) {
2
			cache.stop();
2
			sessionFactory.close();
3
			cache.destroy();
3
			
4
			cache=
4
sessionFactory = null;
5
		}
5
null;
6
		configuration = null;
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.1
Clones locationClones are in different classes
Number of node comparisons12
  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 fragment3
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (cache != null)
    1
    if (cache != null)
    1
    if (sessionFactory != null)
    Differences
    Expression1Expression2Difference
    cachesessionFactoryVARIABLE_NAME_MISMATCH
    org.jboss.cache.TreeCacheorg.hibernate.SessionFactoryVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jboss.cache.TreeCache of variable cache does not match with type org.hibernate.SessionFactory of variable sessionFactory
    • Make classes org.jboss.cache.TreeCache and org.hibernate.SessionFactory extend a common superclass
    1
    if (sessionFactory != null)
                                                        
    2
    sessionFactory.close();
    2
    cache.stop();
                                    
                                                  
    3
    sessionFactory = null;
    3
    cache.destroy();
                                          
    4
    cache = null;
                                
                                                
    4
    configuration = null;
    Precondition Violations (1)
    Row Violation
    1Type org.jboss.cache.TreeCache of variable cache does not match with type org.hibernate.SessionFactory of variable sessionFactory