while (!allowRead())
{
try
{
wait();
}
catch (InterruptedException e)
{
--waitingReaders; // Roll back state.
Log.log(Log.ERROR,this,e);
return;
}
}
while (!allowWrite())
{
try
{
wait();
}
catch (InterruptedException e)
{
--waitingWriters;
Log.log(Log.ERROR,this,e);
return;
}
}
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/util/ReadWriteLock.java
|
|
File path: /jEdit-4.2/src/org/gjt/sp/util/ReadWriteLock.java
|
Method name: void readLock()
|
|
Method name: void writeLock()
|
Number of AST nodes: 3
|
|
Number of AST nodes: 3
|
|
1 | while (!allowRead())↵ | | 1 | while (!allowWrite())↵
|
2 | {↵ | | 2 | {↵
|
3 | try↵ | | 3 | try↵
|
4 | {↵ | | 4 | {↵
|
5 | wait();↵ | | 5 | wait();↵
|
6 | }↵ | | 6 | }↵
|
7 | catch (InterruptedException e)↵ | | 7 | catch (InterruptedException e)↵
|
8 | {↵ | | 8 | {↵
|
9 | --waitingReaders; // Roll back state.↵ | | 9 | --waitingWriters;↵
|
10 | Log.log(Log.ERROR,this,e);↵ | | 10 | Log.log(Log.ERROR,this,e);↵
|
11 | return;↵ | | 11 | return;↵
|
12 | }↵ | | 12 | }↵
|
13 | } | | 13 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 5 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.6 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
5 | while (!allowRead()) | | 9 | while (!allowWrite()) |
6 | | | 10 | |
7 | | | 11 | |
Precondition Violations (2)
Row |
Violation |
1 | Expression waitingReaders is a field being modified, and thus it cannot be parameterized |
2 | Expression waitingWriters is a field being modified, and thus it cannot be parameterized |