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
		}
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.3
Clones locationClones are declared in the same class
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    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
    5
    while (!allowRead())
    5
    while (!allowRead())
    9
    while (!allowWrite())
    Differences
    Expression1Expression2Difference
    allowReadallowWriteMETHOD_INVOCATION_NAME_MISMATCH
    9
    while (!allowWrite())
    6
    try
    6
    try
    10
    try
    Differences
    Expression1Expression2Difference
    waitingReaderswaitingWritersVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression waitingReaders is a field being modified, and thus it cannot be parameterized
    Expression waitingWriters is a field being modified, and thus it cannot be parameterized
    10
    try
    7
    wait();
    11
    wait();
    Precondition Violations (2)
    Row Violation
    1Expression waitingReaders is a field being modified, and thus it cannot be parameterized
    2Expression waitingWriters is a field being modified, and thus it cannot be parameterized