while(is.read(buff) > 0){ os.write(buff); os.flush(); }
synchronized (this) { while (threadsRunning > 0) { wait(); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/tcp/sampler/TCPClientImpl.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/assertions/PackageTest.java
Method name: void write(OutputStream, InputStream) Method name: void testThreadSafety()
Number of AST nodes: 3 Number of AST nodes: 3
1
while(is.read(buff)
1
synchronized (this) {
2
 > 0){
2
			while (threadsRunning > 0) {
3
                os.write(buff);
4
                os.flush();
5
            
3
				wait();
4
			}
6
}
5
		}
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 comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    3
    while (is.read(buff) > 0)
    3
    while (is.read(buff) > 0)
    9
    while (threadsRunning > 0)
    Differences
    Expression1Expression2Difference
    is.read(buff)threadsRunningTYPE_COMPATIBLE_REPLACEMENT
    9
    while (threadsRunning > 0)
    4
    os.write(buff);
    4
    os.write(buff);
    Preondition Violations
    Unmatched statement os.write(buff); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                        
    5
    os.flush();
    5
    os.flush();
    10
    wait();
    Differences
    Expression1Expression2Difference
    flushwaitMETHOD_INVOCATION_NAME_MISMATCH
    osMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression os.flush() is a void method call, and thus it cannot be parameterized
    Expression wait() is a void method call, and thus it cannot be parameterized
    Expression os.flush() is a void method call, and thus it cannot be parameterized
    Expression wait() is a void method call, and thus it cannot be parameterized
    10
    wait();
    Precondition Violations (5)
    Row Violation
    1Unmatched statement os.write(buff); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression os.flush() is a void method call, and thus it cannot be parameterized
    3Expression wait() is a void method call, and thus it cannot be parameterized
    4Expression os.flush() is a void method call, and thus it cannot be parameterized
    5Expression wait() is a void method call, and thus it cannot be parameterized