if (baos != null) { try { baos.close(); } catch (IOException eyeOhEx) { // Ignore exception } } if (errorBaos != null) { try { errorBaos.close(); } catch (IOException eyeOhEx) { // Ignore exception } }
if (r1 != null) { try { r1.close(); } catch (IOException e) { } } if (r2 != null) { try { r2.close(); } catch (IOException e) { } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Redirector.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
Method name: void setProperties() Method name: void tearDown()
Number of AST nodes: 6 Number of AST nodes: 6
1
if (baos != null) {
1
if (r1 != null) {
2
            try {
2
            try {
3
                baos.close();
3
                r1.close();
4
            } catch (IOException eyeOhEx) {
4
            } catch (IOException e) {
5
                // Ignore exception
6
            }
5
            }
7
        }
6
        }
8
        if (errorBaos != null) {
7
        if (r2 != null) {
9
            try {
8
            try {
10
                errorBaos.close();
9
                r2.close();
11
            } catch (IOException eyeOhEx) {
10
            } catch (IOException e
12
                // Ignore exception
11
) {
13
            }
12
            }
14
        }
13
        }
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.5
Clones locationClones are in different classes
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    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
    1
    if (baos != null)
    1
    if (baos != null)
    1
    if (r1 != null)
    Differences
    Expression1Expression2Difference
    baosr1VARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStreamjava.io.ReaderVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStream of variable baos does not match with type java.io.Reader of variable r1
    • Make classes org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStream and java.io.Reader extend a common superclass
    1
    if (r1 != null)
    2
    try
    2
    try
    2
    try
    Differences
    Expression1Expression2Difference
    eyeOhExeVARIABLE_NAME_MISMATCH
    2
    try
    3
    baos.close();
    3
    baos.close();
    3
    r1.close();
    Differences
    Expression1Expression2Difference
    baosr1VARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStreamjava.io.ReaderVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStream of variable baos does not match with type java.io.Reader of variable r1
    • Make classes org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStream and java.io.Reader extend a common superclass
    3
    r1.close();
    4
    if (errorBaos != null)
    4
    if (errorBaos != null)
    4
    if (r2 != null)
    Differences
    Expression1Expression2Difference
    errorBaosr2VARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStreamjava.io.ReaderVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStream of variable errorBaos does not match with type java.io.Reader of variable r2
    • Make classes org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStream and java.io.Reader extend a common superclass
    4
    if (r2 != null)
    5
    try
    5
    try
    5
    try
    Differences
    Expression1Expression2Difference
    eyeOhExeVARIABLE_NAME_MISMATCH
    5
    try
    6
    errorBaos.close();
    6
    errorBaos.close();
    6
    r2.close();
    Differences
    Expression1Expression2Difference
    errorBaosr2VARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStreamjava.io.ReaderVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStream of variable errorBaos does not match with type java.io.Reader of variable r2
    • Make classes org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStream and java.io.Reader extend a common superclass
    6
    r2.close();
    Precondition Violations (4)
    Row Violation
    1Type org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStream of variable baos does not match with type java.io.Reader of variable r1
    2Type org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStream of variable baos does not match with type java.io.Reader of variable r1
    3Type org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStream of variable errorBaos does not match with type java.io.Reader of variable r2
    4Type org.apache.tools.ant.taskdefs.Redirector.PropertyOutputStream of variable errorBaos does not match with type java.io.Reader of variable r2