for (int i = 0; i < size; i++) { final Node newChild = children.item(i); if (newChild != null) { importNode(copy, newChild); } }
for (int i = 0; i < filesets.size(); i++) { FileSet fs = (FileSet) filesets.elementAt(i); if (fs != null) { transferFiles(ftp, fs); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/net/FTP.java
Method name: Node importNode(Node, Node) Method name: void transferFiles(FTPClient)
Number of AST nodes: 4 Number of AST nodes: 4
1
for (int i = 0; i < size; i++) {
1
for (int i = 0; i < filesets.size(); i++) {
2
                    final Node newChild = children.item(i);
2
                FileSet fs = (FileSet) filesets.elementAt(i);
3
    
4
                if (newChild != null) {
3
                if (fs != null) {
5
                        importNode(copy, newChild);
4
                    transferFiles(ftp, fs);
6
                    }
5
                
7
    
6
}
8
            }
7
            }
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.2
Clones locationClones are in different classes
Number of node comparisons8
  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 fragment2
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    39
    for (int i = 0; i < size; i++)
    39
    for (int i = 0; i < size; i++)
    5
    for (int i = 0; i < filesets.size(); i++)
    Differences
    Expression1Expression2Difference
    sizefilesets.size()TYPE_COMPATIBLE_REPLACEMENT
    5
    for (int i = 0; i < filesets.size(); i++)
                                                                                              
    6
    FileSet fs = (FileSet)filesets.elementAt(i);
    Preondition Violations
    Unmatched statement FileSet fs=(FileSet)filesets.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    FileSet fs = (FileSet)filesets.elementAt(i);
    40
    final Node newChild = children.item(i);
    40
    final Node newChild = children.item(i);
    Preondition Violations
    Unmatched statement final Node newChild=children.item(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                      
    41
    if (newChild != null)
    41
    if (newChild != null)
    7
    if (fs != null)
    Differences
    Expression1Expression2Difference
    newChildfsVARIABLE_NAME_MISMATCH
    org.w3c.dom.Nodeorg.apache.tools.ant.types.FileSetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.w3c.dom.Node of variable newChild does not match with type org.apache.tools.ant.types.FileSet of variable fs
    • Make classes org.w3c.dom.Node and org.apache.tools.ant.types.FileSet extend a common superclass
    7
    if (fs != null)
                                                      
    8
    transferFiles(ftp, fs);
    Preondition Violations
    Unmatched statement transferFiles(ftp,fs); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    transferFiles(ftp, fs);
    42
    importNode(copy, newChild);
                                                                
    Precondition Violations (4)
    Row Violation
    1Unmatched statement FileSet fs=(FileSet)filesets.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement final Node newChild=children.item(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.w3c.dom.Node of variable newChild does not match with type org.apache.tools.ant.types.FileSet of variable fs
    4Unmatched statement transferFiles(ftp,fs); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted