for( Iterator i = cleanUpList.iterator(); i.hasNext(); ) { File file = (File) i.next(); file.delete(); }
for (int index = 0; index < files.length; ++index) { // process the deployment descriptor in each tool for (Iterator i = deploymentTools.iterator(); i.hasNext();) { EJBDeploymentTool tool = (EJBDeploymentTool) i.next(); tool.processDescriptor(files[index], saxParser); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ssh/ScpTest.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java
Method name: void tearDown() Method name: void execute()
Number of AST nodes: 3 Number of AST nodes: 4
1
for( Iterator i = cleanUpList
1
for (int index = 0; index < files.length; ++index) {
2
                // process the deployment descriptor in each tool
2
.iterator(); i.hasNext(); ) {
3
                for (Iterator i = deploymentTools.iterator(); i.hasNext();) {
3
            File file = (File) i.next();
4
                    EJBDeploymentTool tool = (EJBDeploymentTool) i.next();
4
            file.delete();
5
                 
6
   tool.processDescriptor(files[index], saxParser);
7
                }
5
        }
8
            }
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.4
Clones locationClones are in different classes
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)9.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    for (Iterator i = cleanUpList.iterator(); i.hasNext(); )
    1
    for (Iterator i = cleanUpList.iterator(); i.hasNext(); )
    21
    for (Iterator i = deploymentTools.iterator(); i.hasNext(); )
    Differences
    Expression1Expression2Difference
    cleanUpListdeploymentToolsVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.ArrayListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable cleanUpList does not match with type java.util.ArrayList of variable deploymentTools
    • Make classes java.util.List and java.util.ArrayList extend a common superclass
    21
    for (Iterator i = deploymentTools.iterator(); i.hasNext(); )
    2
    File file = (File)i.next();
    2
    File file = (File)i.next();
    Preondition Violations
    Unmatched statement File file=(File)i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                            
    3
    file.delete();
    3
    file.delete();
    Preondition Violations
    Unmatched statement file.delete(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                      
                                                                                                                  
    22
    EJBDeploymentTool tool = (EJBDeploymentTool)i.next();
    Preondition Violations
    Unmatched statement EJBDeploymentTool tool=(EJBDeploymentTool)i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    22
    EJBDeploymentTool tool = (EJBDeploymentTool)i.next();
                                                                                                          
    23
    tool.processDescriptor(files[index], saxParser);
    Preondition Violations
    Unmatched statement tool.processDescriptor(files[index],saxParser); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    23
    tool.processDescriptor(files[index], saxParser);
    Precondition Violations (5)
    Row Violation
    1Type java.util.List of variable cleanUpList does not match with type java.util.ArrayList of variable deploymentTools
    2Unmatched statement File file=(File)i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement file.delete(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement EJBDeploymentTool tool=(EJBDeploymentTool)i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement tool.processDescriptor(files[index],saxParser); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted