for (int i = 0; i < magic.length; i++) { if (istream.read() != magic[i]) { throw new BuildException( "Invalid bz2 file." + name); } }
for (int i = 0; i < MAGIC.length; i++) { if (in.read() != MAGIC[i]) { throw new IOException("Invalid bz2 stream."); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Untar.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/BZip2Resource.java
Method name: InputStream decompress(String, InputStream) Method name: InputStream wrapStream(InputStream)
Number of AST nodes: 3 Number of AST nodes: 3
1
for (int i = 0; i < magic.length; i++) {
1
for (int i = 0; i < MAGIC.length; i++) {
2
                        if (istream.read() != magic[i]) {
2
            if (in.read() != MAGIC[i]) {
3
                            throw new BuildException(
3
                throw new IOException(
4
                                                     "Invalid bz2 file." + name);
5
                        }
6
            
4
"Invalid bz2 stream.");
5
            }
7
        }
6
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are in different classes
Number of node comparisons5
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements3
    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.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    for (int i = 0; i < magic.length; i++)
    6
    for (int i = 0; i < magic.length; i++)
    1
    for (int i = 0; i < MAGIC.length; i++)
    Differences
    Expression1Expression2Difference
    magicMAGICVARIABLE_NAME_MISMATCH
    1
    for (int i = 0; i < MAGIC.length; i++)
    7
    if (istream.read() != magic[i])
    7
    if (istream.read() != magic[i])
    2
    if (in.read() != MAGIC[i])
    Differences
    Expression1Expression2Difference
    istreaminVARIABLE_NAME_MISMATCH
    magicMAGICVARIABLE_NAME_MISMATCH
    2
    if (in.read() != MAGIC[i])
    8
    throw new BuildException("Invalid bz2 file." + name);
    8
    throw new BuildException("Invalid bz2 file." + name);
    3
    throw new IOException("Invalid bz2 stream.");
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.BuildExceptionjava.io.IOExceptionSUBCLASS_TYPE_MISMATCH
    "Invalid bz2 file." + name"Invalid bz2 stream."TYPE_COMPATIBLE_REPLACEMENT
    3
    throw new IOException("Invalid bz2 stream.");
    Precondition Violations (0)
    Row Violation