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 cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.8
Clones locationClones are in different classes
Number of node comparisons17
  1. {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)2.1
    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.ReaderSUBCLASS_TYPE_MISMATCH
    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.ReaderSUBCLASS_TYPE_MISMATCH
    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.ReaderSUBCLASS_TYPE_MISMATCH
    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.ReaderSUBCLASS_TYPE_MISMATCH
    6
    r2.close();
    Precondition Violations (0)
    Row Violation