if (in != null) { in.close(); }
if (out != null) { out.close(); } super.tearDown();
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/util/IOInputStream.java File path: /jruby-1.4.0/test/org/jruby/test/TestRubyBase.java
Method name: void close() Method name: void tearDown()
Number of AST nodes: 2 Number of AST nodes: 3
1
if (in != null) {
1
if (out != null) {
2
            in.close();
2
            out.close();
3
        }
3
        }
4
        super.tearDown();
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 in different classes
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)0.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (in != null)
    1
    if (in != null)
    1
    if (out != null)
    Differences
    Expression1Expression2Difference
    inoutVARIABLE_NAME_MISMATCH
    java.io.InputStreamjava.io.PrintStreamVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.InputStream of variable in does not match with type java.io.PrintStream of variable out
    • Make classes java.io.InputStream and java.io.PrintStream extend a common superclass
    1
    if (out != null)
    2
    in.close();
    2
    in.close();
    2
    out.close();
    Differences
    Expression1Expression2Difference
    inoutVARIABLE_NAME_MISMATCH
    java.io.InputStreamjava.io.PrintStreamVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.InputStream of variable in does not match with type java.io.PrintStream of variable out
    • Make classes java.io.InputStream and java.io.PrintStream extend a common superclass
    2
    out.close();
                                            
    3
    super.tearDown();
    Precondition Violations (2)
    Row Violation
    1Type java.io.InputStream of variable in does not match with type java.io.PrintStream of variable out
    2Type java.io.InputStream of variable in does not match with type java.io.PrintStream of variable out