while (!stopped && until > (now = System.currentTimeMillis())) { try { wait(until - now); } catch (InterruptedException e) { // Ignore exception } }
if (device != null) { try { device.close(); } catch (IOException ioex) { //ignore } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/Watchdog.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/FileUtils.java
Method name: void run() Method name: void close(OutputStream)
Number of AST nodes: 3 Number of AST nodes: 3
1
while (!stopped && until > (now = System.currentTimeMillis())) {
1
if (device != null) {
2
            try {
2
            try {
3
                wait(until - now);
3
                device.close();
4
            } catch (InterruptedException e) {
4
            } catch (IOException ioex) {
5
                // Ignore exception
5
                //ignore
6
            }
6
            }
7
        }
7
        }
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 different classes
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    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.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    try
    4
    try
    2
    try
    Differences
    Expression1Expression2Difference
    java.lang.InterruptedExceptionjava.io.IOExceptionSUBCLASS_TYPE_MISMATCH
    eioexVARIABLE_NAME_MISMATCH
    java.lang.InterruptedExceptionjava.io.IOExceptionSUBCLASS_TYPE_MISMATCH
    2
    try
    5
    wait(until - now);
    5
    wait(until - now);
    3
    device.close();
    Differences
    Expression1Expression2Difference
    waitcloseMETHOD_INVOCATION_NAME_MISMATCH
    wait(until - now)device.close()ARGUMENT_NUMBER_MISMATCH
    deviceMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression wait(until - now) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression device.close() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression wait(until - now) is a void method call, and thus it cannot be parameterized
    Expression device.close() is a void method call, and thus it cannot be parameterized
    Expression wait(until - now) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression device.close() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression wait(until - now) is a void method call, and thus it cannot be parameterized
    Expression device.close() is a void method call, and thus it cannot be parameterized
    3
    device.close();
    Precondition Violations (8)
    Row Violation
    1Expression wait(until - now) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression device.close() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    3Expression wait(until - now) is a void method call, and thus it cannot be parameterized
    4Expression device.close() is a void method call, and thus it cannot be parameterized
    5Expression wait(until - now) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    6Expression device.close() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    7Expression wait(until - now) is a void method call, and thus it cannot be parameterized
    8Expression device.close() is a void method call, and thus it cannot be parameterized