if (incl != null) { for (int i = 0; i < incl.length; i++) { createInclude().setName(incl[i]); } }
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/types/PatternSet.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/BZip2Resource.java
Method name: void append(PatternSet, Project) Method name: OutputStream wrapStream(OutputStream)
Number of AST nodes: 3 Number of AST nodes: 3
1
if (incl != null) {
2
            for (int i = 0; i < incl.length; i++) {
1
for (int i = 0; i < MAGIC.length; i++) {
3
                createInclude().setName(incl[i]);
2
            out.write(MAGIC[i]);
4
        
3
        }
5
    }
4
    
6
        }
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 statements1
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    5
    for (int i = 0; i < incl.length; i++)
    5
    for (int i = 0; i < incl.length; i++)
    1
    for (int i = 0; i < MAGIC.length; i++)
    Differences
    Expression1Expression2Difference
    inclMAGICVARIABLE_NAME_MISMATCH
    java.lang.String[]char[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String[] of variable incl 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++)
                                                  
    2
    out.write(MAGIC[i]);
    Preondition Violations
    Unmatched statement out.write(MAGIC[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    out.write(MAGIC[i]);
    6
    createInclude().setName(incl[i]);
    6
    createInclude().setName(incl[i]);
    Preondition Violations
    Unmatched statement createInclude().setName(incl[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                            
                                                                                
    3
    return new CBZip2OutputStream(out);
    Preondition Violations
    Unmatched return new CBZip2OutputStream(out);
    3
    return new CBZip2OutputStream(out);
    Precondition Violations (4)
    Row Violation
    1Type java.lang.String[] of variable incl does not match with type char[] of variable MAGIC
    2Unmatched statement out.write(MAGIC[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement createInclude().setName(incl[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return new CBZip2OutputStream(out);