if (offs < 0) { throw new IndexOutOfBoundsException("offs(" + offs + ") < 0."); } if (len < 0) { throw new IndexOutOfBoundsException("len(" + len + ") < 0."); } if (offs + len > dest.length) { throw new IndexOutOfBoundsException("offs(" + offs + ") + len(" + len + ") > dest.length(" + dest.length + ")."); } if (this.in == null) { throw new IOException("stream closed"); }
if (offs < 0) { throw new IndexOutOfBoundsException("offs(" + offs + ") < 0."); } if (len < 0) { throw new IndexOutOfBoundsException("len(" + len + ") < 0."); } if (offs + len > buf.length) { throw new IndexOutOfBoundsException("offs(" + offs + ") + len(" + len + ") > buf.length(" + buf.length + ")."); } if (this.out == null) { throw new IOException("stream closed"); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/bzip2/CBZip2InputStream.java File path: /apache-ant-1.7.0/src/org/apache/tools/bzip2/CBZip2OutputStream.java
Method name: int read(byte[], int, int) Method name: void write(byte[], int, int)
Number of AST nodes: 8 Number of AST nodes: 8
1
if (offs < 0) {
1
if (offs < 0) {
2
            throw new IndexOutOfBoundsException("offs(" + offs + ") < 0.");
2
            throw new IndexOutOfBoundsException("offs(" + offs + ") < 0.");
3
        }
3
        }
4
        if (len < 0) {
4
        if (len < 0) {
5
            throw new IndexOutOfBoundsException("len(" + len + ") < 0.");
5
            throw new IndexOutOfBoundsException("len(" + len + ") < 0.");
6
        }
6
        }
7
        if (offs + len > dest.length) {
7
        if (offs + len > buf.length) {
8
            throw new IndexOutOfBoundsException("offs(" + offs + ") + len("
8
            throw new IndexOutOfBoundsException("offs(" + offs + ") + len("
9
                                                + len + ") > dest.length("
9
                                                + len + ") > buf.length("
10
                                                + dest.length + ").");
10
                                                + buf.length + ").");
11
        }
11
        }
12
        if (this.in == null) {
12
        if (this.out == null) {
13
            throw new IOException("stream closed");
13
            throw new IOException("stream closed");
14
        }
14
        }
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)1.4
Clones locationClones are in different classes
Number of node comparisons46
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (offs < 0)
    1
    if (offs < 0)
    2
    throw new IndexOutOfBoundsException("offs(" + offs + ") < 0.");
    2
    throw new IndexOutOfBoundsException("offs(" + offs + ") < 0.");
    3
    if (len < 0)
    3
    if (len < 0)
    4
    throw new IndexOutOfBoundsException("len(" + len + ") < 0.");
    4
    throw new IndexOutOfBoundsException("len(" + len + ") < 0.");
    5
    if (offs + len > dest.length)
    5
    if (offs + len > dest.length)
    5
    if (offs + len > buf.length)
    Differences
    Expression1Expression2Difference
    destbufVARIABLE_NAME_MISMATCH
    5
    if (offs + len > buf.length)
    6
    throw new IndexOutOfBoundsException("offs(" + offs + ") + len(" + len + ") > dest.length(" + dest.length + ").");
    6
    throw new IndexOutOfBoundsException("offs(" + offs + ") + len(" + len + ") > dest.length(" + dest.length + ").");
    6
    throw new IndexOutOfBoundsException("offs(" + offs + ") + len(" + len + ") > buf.length(" + buf.length + ").");
    Differences
    Expression1Expression2Difference
    ") > dest.length("") > buf.length("LITERAL_VALUE_MISMATCH
    destbufVARIABLE_NAME_MISMATCH
    6
    throw new IndexOutOfBoundsException("offs(" + offs + ") + len(" + len + ") > buf.length(" + buf.length + ").");
    7
    if (this.in == null)
    7
    if (this.in == null)
    7
    if (this.out == null)
    Differences
    Expression1Expression2Difference
    inoutVARIABLE_NAME_MISMATCH
    java.io.InputStreamjava.io.OutputStreamVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.InputStream of variable this.in does not match with type java.io.OutputStream of variable this.out
    • Make classes java.io.InputStream and java.io.OutputStream extend a common superclass
    7
    if (this.out == null)
    8
    throw new IOException("stream closed");
    8
    throw new IOException("stream closed");
    Precondition Violations (1)
    Row Violation
    1Type java.io.InputStream of variable this.in does not match with type java.io.OutputStream of variable this.out