out.flush(); out.close(); out = null;
los.write(0); los.close(); assertTrue(f + " has been written.", f.exists());
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/mail/MailMessageTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java
Method name: void disconnect() Method name: void testSingleByte()
Number of AST nodes: 3 Number of AST nodes: 3
1
out.flush();
2
                    out.close();
3
                    out = null
1
los.write(0);
2
        los.close();
4
;
3
        assertTrue(f + " has been written.", f.exists());
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.0
Clones locationClones are in different classes
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                    
    1
    los.write(0);
    3
    out.flush();
    3
    out.flush();
    3
    assertTrue(f + " has been written.", f.exists());
    Differences
    Expression1Expression2Difference
    flushassertTrueMETHOD_INVOCATION_NAME_MISMATCH
    out.flush()assertTrue(f + " has been written.",f.exists())ARGUMENT_NUMBER_MISMATCH
    outMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression out.flush() is a void method call, and thus it cannot be parameterized
    Expression assertTrue(f + " has been written.",f.exists()) is a void method call, and thus it cannot be parameterized
    Expression out.flush() is a void method call, and thus it cannot be parameterized
    Expression assertTrue(f + " has been written.",f.exists()) is a void method call, and thus it cannot be parameterized
    3
    assertTrue(f + " has been written.", f.exists());
    4
    out.close();
    4
    out.close();
    2
    los.close();
    Differences
    Expression1Expression2Difference
    outlosVARIABLE_NAME_MISMATCH
    java.io.BufferedWriterorg.apache.tools.ant.util.LazyFileOutputStreamVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.BufferedWriter of variable out does not match with type org.apache.tools.ant.util.LazyFileOutputStream of variable los
    • Make classes java.io.BufferedWriter and org.apache.tools.ant.util.LazyFileOutputStream extend a common superclass
    2
    los.close();
    Precondition Violations (5)
    Row Violation
    1Expression out.flush() is a void method call, and thus it cannot be parameterized
    2Expression assertTrue(f + " has been written.",f.exists()) is a void method call, and thus it cannot be parameterized
    3Expression out.flush() is a void method call, and thus it cannot be parameterized
    4Expression assertTrue(f + " has been written.",f.exists()) is a void method call, and thus it cannot be parameterized
    5Type java.io.BufferedWriter of variable out does not match with type org.apache.tools.ant.util.LazyFileOutputStream of variable los