if (srcFiles != null) { 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(); } } if (filelist.length() > 0) { execP4Add(filelist); } } else { log("No files specified to add!", Project.MSG_WARN); }
if (srcFiles != null) { 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(); } } if (filelist.length() > 0) { execP4Fstat(filelist); } } else { log("No files specified to query status on!", Project.MSG_WARN); }
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: 10 Number of AST nodes: 11
1
if (srcFiles != null) {
1
if (srcFiles != null) {
2
                for (int j = 0; j < srcFiles.length; j++) {
2
                for (int j = 0; j < srcFiles.length; j++) {
3
                    File f = new File(ds.getBasedir(), srcFiles[j]);
3
                    File f = new File(ds.getBasedir(), srcFiles[j]);
4
                    filelist.append(" ").append('"').append(f.getAbsolutePath()).append('"');
4
                    filelist.append(" ").append('"').append(f.getAbsolutePath()).append('"');
5
                    doneFileNum++;
5
                    if (filelist.length() > cmdLength) {
6
                    if (filelist.length() > cmdLength) {
6
                        execP4Add(filelist);
7
                        execP4Fstat(filelist);
7
                        filelist = new StringBuffer();
8
                        filelist = new StringBuffer();
8
                    }
9
                    }
9
                }
10
                }
10
                if (filelist.length() > 0) {
11
                if (filelist.length() > 0) {
11
                    execP4Add(filelist);
12
                    execP4Fstat(filelist);
12
                }
13
                }
13
            } else {
14
            } else {
14
                log("No files specified to add!", Project.MSG_WARN);
15
                log("No files specified to query status on!", Project.MSG_WARN);
15
            }
16
            }
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.5
Clones locationClones are in different classes having the same super class
Number of node comparisons31
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    9
    if (srcFiles != null)
    11
    if (srcFiles != null)
    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();
    16
    if (filelist.length() > 0)
    19
    if (filelist.length() > 0)
    17
    execP4Add(filelist);
    17
    execP4Add(filelist);
    20
    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
    20
    execP4Fstat(filelist);
    else
    else
    18
    log("No files specified to add!", Project.MSG_WARN);
    18
    log("No files specified to add!", Project.MSG_WARN);
    21
    log("No files specified to query status on!", Project.MSG_WARN);
    Differences
    Expression1Expression2Difference
    "No files specified to add!""No files specified to query status on!"LITERAL_VALUE_MISMATCH
    21
    log("No files specified to query status on!", Project.MSG_WARN);
    Precondition Violations (9)
    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
    6Expression execP4Add(filelist) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression execP4Fstat(filelist) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression execP4Add(filelist) is a void method call, and thus it cannot be parameterized
    9Expression execP4Fstat(filelist) is a void method call, and thus it cannot be parameterized