if (appendReader != null) { ch = appendReader.read(); if (ch == -1) { // I am the only one so I have to close the reader appendReader.close(); appendReader = null; } }
if (prependReader != null) { ch = prependReader.read(); if (ch == -1) { // I am the only one so I have to close the reader prependReader.close(); prependReader = null; } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/ConcatFilter.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/ConcatFilter.java
Method name: int read() Method name: int read()
Number of AST nodes: 5 Number of AST nodes: 5
1
if (appendReader != null) {
1
if (prependReader != null) {
2
                ch = appendReader.read();
2
            ch = prependReader.read();
3
                if (ch == -1) {
3
            if (ch == -1) {
4
                    // I am the only one so I have to close the reader
4
                // I am the only one so I have to close the reader
5
                    appendReader.close();
5
                prependReader.close();
6
                    appendReader = null;
6
                prependReader = null;
7
                }
7
            
8
    
8
}
9
        }
9
        }
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 the same method
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    13
    if (appendReader != null)
    13
    if (appendReader != null)
    5
    if (prependReader != null)
    Differences
    Expression1Expression2Difference
    appendReaderprependReaderVARIABLE_NAME_MISMATCH
    5
    if (prependReader != null)
    14
    ch = appendReader.read();
    14
    ch = appendReader.read();
    6
    ch = prependReader.read();
    Differences
    Expression1Expression2Difference
    appendReaderprependReaderVARIABLE_NAME_MISMATCH
    6
    ch = prependReader.read();
    15
    if (ch == -1)
    7
    if (ch == -1)
    16
    appendReader.close();
    16
    appendReader.close();
    8
    prependReader.close();
    Differences
    Expression1Expression2Difference
    appendReaderprependReaderVARIABLE_NAME_MISMATCH
    8
    prependReader.close();
    17
    appendReader = null;
    17
    appendReader = null;
    9
    prependReader = null;
    Differences
    Expression1Expression2Difference
    appendReaderprependReaderVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression appendReader is a field being modified, and thus it cannot be parameterized
    Expression prependReader is a field being modified, and thus it cannot be parameterized
    9
    prependReader = null;
    Precondition Violations (2)
    Row Violation
    1Expression appendReader is a field being modified, and thus it cannot be parameterized
    2Expression prependReader is a field being modified, and thus it cannot be parameterized