while (line != null) { if (line.length() == 0) { bw.newLine(); } else { newline = KeySubst.replace(line, replacements); bw.write(newline); bw.newLine(); } line = br.readLine(); }
while (line != null) { if (line.length() == 0) { // this should not happen, because the lines are // returned with the end of line delimiter out.newLine(); } else { newline = filters.replaceTokens(line); out.write(newline); } line = lineTokenizer.getToken(in); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/KeySubst.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/ResourceUtils.java
Method name: void execute() Method name: void copyResource(Resource, Resource, FilterSetCollection, Vector, boolean, boolean, String, String, Project)
Number of AST nodes: 7 Number of AST nodes: 6
1
while (line != null) {
1
while (line != null) {
2
                if (line.length() == 0) {
2
                    if (line.length() == 0) {
3
                    bw
3
                        // this should not happen, because the lines are
4
                        // returned with the end of line delimiter
4
.newLine();
5
                        out.newLine();
5
                } else {
6
                    } else {
6
                    newline = KeySubst.replace(line, replacements);
7
                        newline = filters.replaceTokens(line);
7
                    bw.write(newline);
8
                        out.write(newline);
8
                    bw.newLine();
9
                    
9
                }
10
}
10
                line = br.readLine();
11
                    line = 
12
lineTokenizer.getToken(in);
11
            }
13
                }
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 comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    15
    while (line != null)
    33
    while (line != null)
    16
    if (line.length() == 0)
    34
    if (line.length() == 0)
    17
    bw.newLine();
    17
    bw.newLine();
    35
    out.newLine();
    Differences
    Expression1Expression2Difference
    bwoutVARIABLE_NAME_MISMATCH
    35
    out.newLine();
    else
    else
    18
    newline = KeySubst.replace(line, replacements);
    18
    newline = KeySubst.replace(line, replacements);
    Preondition Violations
    Unmatched statement newline=KeySubst.replace(line,replacements); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                    
                                                                                    
    36
    newline = filters.replaceTokens(line);
    Preondition Violations
    Unmatched statement newline=filters.replaceTokens(line); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    36
    newline = filters.replaceTokens(line);
    19
    bw.write(newline);
    19
    bw.write(newline);
    37
    out.write(newline);
    Differences
    Expression1Expression2Difference
    bwoutVARIABLE_NAME_MISMATCH
    37
    out.write(newline);
    20
    bw.newLine();
    20
    bw.newLine();
    Preondition Violations
    Unmatched statement bw.newLine(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                      
    21
    line = br.readLine();
    21
    line = br.readLine();
    Preondition Violations
    Unmatched statement line=br.readLine(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                  
                                                                            
    38
    line = lineTokenizer.getToken(in);
    Preondition Violations
    Unmatched statement line=lineTokenizer.getToken(in); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    38
    line = lineTokenizer.getToken(in);
    Precondition Violations (5)
    Row Violation
    1Unmatched statement newline=KeySubst.replace(line,replacements); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement newline=filters.replaceTokens(line); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement bw.newLine(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement line=br.readLine(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement line=lineTokenizer.getToken(in); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted