while ( parentPropIter.hasNext() ) { String currentPropertyName = ( (Property) parentPropIter.next() ).getName(); String currentName = reducedName + '.' + currentPropertyName; if (hasFollowers) { followers.add( currentName ); } if ( name.equals( currentName ) ) hasFollowers = true; }
while (tests.hasMoreElements()) { Test t = (Test) tests.nextElement(); if (t instanceof TestCase) { String name = ((TestCase) t).getName(); if (!failureExpected.contains(name + "FailureExpected")) { result.addTest(t); } } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/ResultSetMappingBinder.java File path: /hibernate-distribution-3.3.2.GA/project/testing/src/main/java/org/hibernate/junit/UnitTestCase.java
Method name: java.util.Map bindPropertyResults(String, Element, PersistentClass, Mappings) Method name: TestSuite createFailureExpectedSuite(Class)
Number of AST nodes: 7 Number of AST nodes: 6
1
while ( parentPropIter.hasNext() ) {
1
while (tests.hasMoreElements()) {
2
					String currentPropertyName = ( (Property) parentPropIter.next() ).getName();
3
					String currentName = reducedName + '.' + currentPropertyName;
4
					if (hasFollowers) {
5
						followers.add( currentName );
6
					}
7
					if ( name.equals( currentName ) ) hasFollowers = true;
8
				
2
          Test t = (Test) tests.nextElement();
3
          if (t instanceof TestCase) {
4
             String name = ((TestCase) t).getName();
5
             if (!failureExpected.contains(name + "FailureExpected")) {
6
                result.addTest(t);
7
             }
8
          }       
9
}
9
       }
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 comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    38
    String currentPropertyName = ((Property)parentPropIter.next()).getName();
    38
    String currentPropertyName = ((Property)parentPropIter.next()).getName();
    Preondition Violations
    Unmatched statement String currentPropertyName=((Property)parentPropIter.next()).getName(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                          
    39
    String currentName = reducedName + '.' + currentPropertyName;
    39
    String currentName = reducedName + '.' + currentPropertyName;
    15
    String name = ((TestCase)t).getName();
    Differences
    Expression1Expression2Difference
    currentNamenameVARIABLE_NAME_MISMATCH
    reducedName + '.' + currentPropertyName((TestCase)t).getName()TYPE_COMPATIBLE_REPLACEMENT
    15
    String name = ((TestCase)t).getName();
    40
    if (hasFollowers)
    40
    if (hasFollowers)
    16
    if (!failureExpected.contains(name + "FailureExpected"))
    Differences
    Expression1Expression2Difference
    hasFollowers!failureExpected.contains(name + "FailureExpected")TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression !failureExpected.contains(name + "FailureExpected") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    if (!failureExpected.contains(name + "FailureExpected"))
                                                
    17
    result.addTest(t);
    41
    followers.add(currentName);
    41
    followers.add(currentName);
    Preondition Violations
    Unmatched statement followers.add(currentName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                  
    Precondition Violations (4)
    Row Violation
    1Unmatched statement String currentPropertyName=((Property)parentPropIter.next()).getName(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression !failureExpected.contains(name + "FailureExpected") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement followers.add(currentName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Clone fragment #1 returns variables currentName , while Clone fragment #2 returns variables