if (environment != null) { for (int i = 0; i < environment.length; i++) { log("Setting environment variable: " + environment[i], Project.MSG_VERBOSE); } }
for (int i = 0; i < MAGIC.length; i++) { out.write(MAGIC[i]); } return new CBZip2OutputStream(out);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/BZip2Resource.java
Method name: TestResultHolder executeAsForked(JUnitTest, ExecuteWatchdog, File) Method name: OutputStream wrapStream(OutputStream)
Number of AST nodes: 3 Number of AST nodes: 3
1
if (environment != null) {
2
            for (int i = 0; i < environment.length; i++) {
1
for (int i = 0; i < MAGIC.length; i++) {
3
                log("Setting environment variable: " + environment[i],
2
            out.write(MAGIC[i]);
4
            
3
        }
5
        Project.MSG_VERBOSE);
4
        
6
            }
7
        }
5
return new CBZip2OutputStream(out);
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 having the same super class
Number of node comparisons4
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    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.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    64
    for (int i = 0; i < environment.length; i++)
    64
    for (int i = 0; i < environment.length; i++)
    1
    for (int i = 0; i < MAGIC.length; i++)
    Differences
    Expression1Expression2Difference
    environmentMAGICVARIABLE_NAME_MISMATCH
    java.lang.String[]char[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String[] of variable environment does not match with type char[] of variable MAGIC
    • Make classes java.lang.String[] and char[] extend a common superclass
    1
    for (int i = 0; i < MAGIC.length; i++)
    65
    log("Setting environment variable: " + environment[i], Project.MSG_VERBOSE);
    65
    log("Setting environment variable: " + environment[i], Project.MSG_VERBOSE);
    2
    out.write(MAGIC[i]);
    Differences
    Expression1Expression2Difference
    logwriteMETHOD_INVOCATION_NAME_MISMATCH
    log("Setting environment variable: " + environment[i],Project.MSG_VERBOSE)out.write(MAGIC[i])ARGUMENT_NUMBER_MISMATCH
    outMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression log("Setting environment variable: " + environment[i],Project.MSG_VERBOSE) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression out.write(MAGIC[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log("Setting environment variable: " + environment[i],Project.MSG_VERBOSE) is a void method call, and thus it cannot be parameterized
    Expression out.write(MAGIC[i]) is a void method call, and thus it cannot be parameterized
    Expression log("Setting environment variable: " + environment[i],Project.MSG_VERBOSE) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression out.write(MAGIC[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log("Setting environment variable: " + environment[i],Project.MSG_VERBOSE) is a void method call, and thus it cannot be parameterized
    Expression out.write(MAGIC[i]) is a void method call, and thus it cannot be parameterized
    2
    out.write(MAGIC[i]);
                                                                                
    3
    return new CBZip2OutputStream(out);
    Preondition Violations
    Unmatched return new CBZip2OutputStream(out);
    3
    return new CBZip2OutputStream(out);
    Precondition Violations (10)
    Row Violation
    1Type java.lang.String[] of variable environment does not match with type char[] of variable MAGIC
    2Expression log("Setting environment variable: " + environment[i],Project.MSG_VERBOSE) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression out.write(MAGIC[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression log("Setting environment variable: " + environment[i],Project.MSG_VERBOSE) is a void method call, and thus it cannot be parameterized
    5Expression out.write(MAGIC[i]) is a void method call, and thus it cannot be parameterized
    6Expression log("Setting environment variable: " + environment[i],Project.MSG_VERBOSE) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression out.write(MAGIC[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression log("Setting environment variable: " + environment[i],Project.MSG_VERBOSE) is a void method call, and thus it cannot be parameterized
    9Expression out.write(MAGIC[i]) is a void method call, and thus it cannot be parameterized
    10Unmatched return new CBZip2OutputStream(out);