try { oneMutex.lock(); worker.add(w); } finally { oneMutex.release(); } // notify that a new worker is available wakeUp();
try { workerListMutex.lock(); workerList.add(t); } finally { workerListMutex.release(); } fireWorkerAdded(t);
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/command/CommandProcessor.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/command/TaskManager.java
Method name: void operationFinished(ICommand, Worker) Method name: void register(Worker)
Number of AST nodes: 4 Number of AST nodes: 4
1
try {
1
try {
2
	    oneMutex.lock();
2
	    workerListMutex.lock();
3
	    worker.add(w);
3
	    workerList.add(t);
4
	} finally {
4
	} finally {
5
	    oneMutex.release();
5
	    workerListMutex.release();
6
	}
6
	}
7
	// notify that a new worker is available
7
	
8
	wakeUp();
8
fireWorkerAdded(t);
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.1
Clones locationClones are in different classes
Number of node comparisons10
  1. {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)2.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    1
    try
    Differences
    Expression1Expression2Difference
    oneMutexworkerListMutexVARIABLE_NAME_MISMATCH
    1
    try
    2
    oneMutex.lock();
    2
    oneMutex.lock();
    2
    workerListMutex.lock();
    Differences
    Expression1Expression2Difference
    oneMutexworkerListMutexVARIABLE_NAME_MISMATCH
    2
    workerListMutex.lock();
    3
    worker.add(w);
    3
    worker.add(w);
    3
    workerList.add(t);
    Differences
    Expression1Expression2Difference
    wtVARIABLE_NAME_MISMATCH
    workerworkerListVARIABLE_NAME_MISMATCH
    3
    workerList.add(t);
    4
    wakeUp();
    4
    wakeUp();
    4
    fireWorkerAdded(t);
    Differences
    Expression1Expression2Difference
    wakeUpfireWorkerAddedMETHOD_INVOCATION_NAME_MISMATCH
    wakeUp()fireWorkerAdded(t)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression wakeUp() is a void method call, and thus it cannot be parameterized
    Expression fireWorkerAdded(t) is a void method call, and thus it cannot be parameterized
    Expression wakeUp() is a void method call, and thus it cannot be parameterized
    Expression fireWorkerAdded(t) is a void method call, and thus it cannot be parameterized
    4
    fireWorkerAdded(t);
    Precondition Violations (4)
    Row Violation
    1Expression wakeUp() is a void method call, and thus it cannot be parameterized
    2Expression fireWorkerAdded(t) is a void method call, and thus it cannot be parameterized
    3Expression wakeUp() is a void method call, and thus it cannot be parameterized
    4Expression fireWorkerAdded(t) is a void method call, and thus it cannot be parameterized