DualNodeJtaTransactionManagerImpl tm = (DualNodeJtaTransactionManagerImpl) INSTANCES.get(nodeId); if (tm == null) { tm = new DualNodeJtaTransactionManagerImpl(nodeId); INSTANCES.put(nodeId, tm); } return tm;
CollectionStatistics cs = (CollectionStatistics) collectionStatistics.get(role); if (cs==null) { cs = new CollectionStatistics(role); collectionStatistics.put(role, cs); } return cs;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/util/DualNodeJtaTransactionManagerImpl.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/stat/StatisticsImpl.java
Method name: DualNodeJtaTransactionManagerImpl getInstance(String) Method name: CollectionStatistics getCollectionStatistics(String)
Number of AST nodes: 5 Number of AST nodes: 5
1
DualNodeJtaTransactionManagerImpl tm = (DualNodeJtaTransactionManagerImpl) INSTANCES.get(nodeId);
2
	    
1
CollectionStatistics cs = (CollectionStatistics) collectionStatistics.get(role);
3
if (tm == null) {
2
		if (cs==null) {
4
	        tm = new DualNodeJtaTransactionManagerImpl(nodeId);
3
	
5
	        INSTANCES.put(nodeId, tm);
6
	    
4
		cs = new CollectionStatistics(role);
5
			collectionStatistics.put(role, cs);
7
}
6
		}
8
		return tm;
7
		return cs;
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 comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    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.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                                    
    1
    CollectionStatistics cs = (CollectionStatistics)collectionStatistics.get(role);
    1
    DualNodeJtaTransactionManagerImpl tm = (DualNodeJtaTransactionManagerImpl)INSTANCES.get(nodeId);
                                                                                                                                                                                                      
    2
    if (tm == null)
    2
    if (tm == null)
    2
    if (cs == null)
    Differences
    Expression1Expression2Difference
    tmcsVARIABLE_NAME_MISMATCH
    org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionManagerImplorg.hibernate.stat.CollectionStatisticsVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionManagerImpl of variable tm does not match with type org.hibernate.stat.CollectionStatistics of variable cs
    • Make classes org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionManagerImpl and org.hibernate.stat.CollectionStatistics extend a common superclass
    2
    if (cs == null)
                                                                              
    3
    cs = new CollectionStatistics(role);
    Preondition Violations
    Unmatched statement cs=new CollectionStatistics(role); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    cs = new CollectionStatistics(role);
    3
    tm = new DualNodeJtaTransactionManagerImpl(nodeId);
    3
    tm = new DualNodeJtaTransactionManagerImpl(nodeId);
    Preondition Violations
    Unmatched statement tm=new DualNodeJtaTransactionManagerImpl(nodeId); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                            
    4
    INSTANCES.put(nodeId, tm);
    4
    INSTANCES.put(nodeId, tm);
    4
    collectionStatistics.put(role, cs);
    Differences
    Expression1Expression2Difference
    nodeIdroleVARIABLE_NAME_MISMATCH
    tmcsVARIABLE_NAME_MISMATCH
    org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionManagerImplorg.hibernate.stat.CollectionStatisticsVARIABLE_TYPE_MISMATCH
    INSTANCEScollectionStatisticsVARIABLE_NAME_MISMATCH
    java.util.Hashtablejava.util.MapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionManagerImpl of variable tm does not match with type org.hibernate.stat.CollectionStatistics of variable cs
    • Make classes org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionManagerImpl and org.hibernate.stat.CollectionStatistics extend a common superclass
    Type java.util.Hashtable of variable INSTANCES does not match with type java.util.Map of variable collectionStatistics
    • Make classes java.util.Hashtable and java.util.Map extend a common superclass
    4
    collectionStatistics.put(role, cs);
                              
    5
    return cs;
    Preondition Violations
    Unmatched return cs;
    5
    return cs;
    5
    return tm;
    5
    return tm;
    Preondition Violations
    Unmatched return tm;
                              
    Precondition Violations (7)
    Row Violation
    1Type org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionManagerImpl of variable tm does not match with type org.hibernate.stat.CollectionStatistics of variable cs
    2Unmatched statement cs=new CollectionStatistics(role); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement tm=new DualNodeJtaTransactionManagerImpl(nodeId); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionManagerImpl of variable tm does not match with type org.hibernate.stat.CollectionStatistics of variable cs
    5Type java.util.Hashtable of variable INSTANCES does not match with type java.util.Map of variable collectionStatistics
    6Unmatched return cs;
    7Unmatched return tm;