if (running[i] != null && !running[i].isFinished()) { //System.out.println("Thread " + i + " is still alive "); // still running - wait for it try { semaphore.wait(); } catch (InterruptedException ie) { // who would interrupt me at a time like this? } continue outer2; }
for (int i = 0; i < maxRunning; ++i) { if (running[i] != null && !running[i].isFinished()) { //System.out.println("Thread " + i + " is still alive "); // still running - wait for it try { semaphore.wait(); } catch (InterruptedException ie) { // who would interrupt me at a time like this? } continue outer2; } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Parallel.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Parallel.java
Method name: void spinThreads() Method name: void spinThreads()
Number of AST nodes: 4 Number of AST nodes: 5
1
for (int i = 0; i < maxRunning; ++i) {
1
if (running[i] != null && !running[i].isFinished()) {
2
                    if (running[i] != null && !running[i].isFinished()) {
2
                        //System.out.println("Thread " + i + " is still alive ");
3
                        //System.out.println("Thread " + i + " is still alive ");
3
                        // still running - wait for it
4
                        // still running - wait for it
4
                        try {
5
                        try {
5
                            semaphore.wait();
6
                            semaphore.wait();
6
                        } catch (InterruptedException ie) {
7
                        } catch (InterruptedException ie) {
7
                            // who would interrupt me at a time like this?
8
                            // who would interrupt me at a time like this?
8
                        }
9
                        }
9
                        continue outer2;
10
                        continue outer2;
10
                    }
11
                    }
12
                }
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.4
Clones locationClones are in the same method
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    42
    if (running[i] != null && !running[i].isFinished())
    42
    if (running[i] != null && !running[i].isFinished())
    43
    try
    43
    try
    44
    semaphore.wait();
    44
    semaphore.wait();
    45
    continue outer2;
    45
    continue outer2;
    45
    continue outer2;
    Preondition Violations
    Statement continue outer2; without innermost loop
    Statement continue outer2; without innermost loop
    45
    continue outer2;
    Precondition Violations (2)
    Row Violation
    1Statement continue outer2; without innermost loop
    2Statement continue outer2; without innermost loop