for (int j = 0; j < srcFiles.length; j++) { File f = new File(ds.getBasedir(), srcFiles[j]); filelist.append(" ").append('"').append(f.getAbsolutePath()).append('"'); if (filelist.length() > cmdLength) { execP4Add(filelist); filelist = new StringBuffer(); } }
for (int j = 0; j < srcFiles.length; j++) { File f = new File(ds.getBasedir(), srcFiles[j]); filelist.append(" ").append('"').append(f.getAbsolutePath()).append('"'); doneFileNum++; if (filelist.length() > cmdLength) { execP4Fstat(filelist); filelist = new StringBuffer(); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java
Method name: void execute() Method name: void execute()
Number of AST nodes: 6 Number of AST nodes: 7
1
for (int j = 0; j < srcFiles.length; j++) {
1
for (int j = 0; j < srcFiles.length; j++) {
2
                    File f = new File(ds.getBasedir(), srcFiles[j]);
2
                    File f = new File(ds.getBasedir(), srcFiles[j]);
3
                    filelist.append(" ").append('"').append(f.getAbsolutePath()).append('"');
3
                    filelist.append(" ").append('"').append(f.getAbsolutePath()).append('"');
4
                    doneFileNum++;
4
                    if (filelist.length() > cmdLength) {
5
                    if (filelist.length() > cmdLength) {
5
                        execP4Add(filelist);
6
                        execP4Fstat(filelist);
6
                        filelist = new StringBuffer();
7
                        filelist = new StringBuffer();
7
                    }
8
                    }
8
                }
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons24
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    10
    for (int j = 0; j < srcFiles.length; j++)
    12
    for (int j = 0; j < srcFiles.length; j++)
    11
    File f = new File(ds.getBasedir(), srcFiles[j]);
    13
    File f = new File(ds.getBasedir(), srcFiles[j]);
    12
    filelist.append(" ").append('"').append(f.getAbsolutePath()).append('"');
    14
    filelist.append(" ").append('"').append(f.getAbsolutePath()).append('"');
                                        
    15
    doneFileNum++;
    Preondition Violations
    Unmatched statement doneFileNum++; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15
    doneFileNum++;
    13
    if (filelist.length() > cmdLength)
    16
    if (filelist.length() > cmdLength)
    14
    execP4Add(filelist);
    14
    execP4Add(filelist);
    17
    execP4Fstat(filelist);
    Differences
    Expression1Expression2Difference
    execP4AddexecP4FstatMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression execP4Add(filelist) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method execP4Add
    Expression execP4Fstat(filelist) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method execP4Fstat
    Expression execP4Add(filelist) is a void method call, and thus it cannot be parameterized
    Expression execP4Fstat(filelist) is a void method call, and thus it cannot be parameterized
    17
    execP4Fstat(filelist);
    15
    filelist = new StringBuffer();
    18
    filelist = new StringBuffer();
    Precondition Violations (6)
    Row Violation
    1Unmatched statement doneFileNum++; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression execP4Add(filelist) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression execP4Fstat(filelist) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression execP4Add(filelist) is a void method call, and thus it cannot be parameterized
    5Expression execP4Fstat(filelist) is a void method call, and thus it cannot be parameterized
    6Clone fragment #1 returns variables filelist , while Clone fragment #2 returns variables