OutputStream out = getResource().getOutputStream(); if (out != null) { out = wrapStream(out); } return out;
InputStream in = getResource().getInputStream(); if (in != null) { in = wrapStream(in); } return in;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/CompressedResource.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/CompressedResource.java
Method name: OutputStream getOutputStream() Method name: InputStream getInputStream()
Number of AST nodes: 4 Number of AST nodes: 4
1
OutputStream out = getResource().getOutputStream();
1
InputStream in = getResource().getInputStream();
2
        if (out != null) {
2
        if (in != null) {
3
            out = wrapStream(out);
3
            in = wrapStream(in);
4
        }
4
        }
5
        return out;
5
        return in;
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.1
Clones locationClones are declared in the same class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                      
    1
    InputStream in = getResource().getInputStream();
    1
    OutputStream out = getResource().getOutputStream();
                                                                                                            
    2
    if (out != null)
    2
    if (out != null)
    2
    if (in != null)
    Differences
    Expression1Expression2Difference
    outinVARIABLE_NAME_MISMATCH
    java.io.OutputStreamjava.io.InputStreamVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.OutputStream of variable out does not match with type java.io.InputStream of variable in
    • Make classes java.io.OutputStream and java.io.InputStream extend a common superclass
    2
    if (in != null)
                                              
    3
    in = wrapStream(in);
    Preondition Violations
    Unmatched statement in=wrapStream(in); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    in = wrapStream(in);
    3
    out = wrapStream(out);
    3
    out = wrapStream(out);
    Preondition Violations
    Unmatched statement out=wrapStream(out); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                  
                              
    4
    return in;
    Preondition Violations
    Unmatched return in;
    4
    return in;
    4
    return out;
    4
    return out;
    Preondition Violations
    Unmatched return out;
                                
    Precondition Violations (5)
    Row Violation
    1Type java.io.OutputStream of variable out does not match with type java.io.InputStream of variable in
    2Unmatched statement in=wrapStream(in); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement out=wrapStream(out); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return in;
    5Unmatched return out;