if (now) { Thread t = (Thread) allThreadsSave.get(thrd); if (t != null) { t.interrupt(); } }
if (save.saveUrl()) { final URL url = res.getURL(); if (url != null) { writeItem(url, context, writer); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/engine/StandardJMeterEngine.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/save/converters/SampleResultConverter.java
Method name: boolean stopThread(String, boolean) Method name: void saveSamplerData(HierarchicalStreamWriter, MarshallingContext, SampleResult, SampleSaveConfiguration)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (now) {
1
if (
2
				Thread t = (Thread) allThreadsSave.get(thrd);
3
				
2
save.saveUrl()) {
3
            final URL url = res.getURL();
4
if (t != null) {
4
            if (url != null) {
5
					t.interrupt();
6
				}
7
			
5
            	writeItem(url, context, writer);
6
            }
8
}
7
        }
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 comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)9.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    8
    if (now)
    8
    if (now)
    3
    if (save.saveUrl())
    Differences
    Expression1Expression2Difference
    nowsave.saveUrl()TYPE_COMPATIBLE_REPLACEMENT
    3
    if (save.saveUrl())
                                                                
    4
    final URL url = res.getURL();
    9
    Thread t = (Thread)allThreadsSave.get(thrd);
                                                                                              
    10
    if (t != null)
    10
    if (t != null)
    5
    if (url != null)
    Differences
    Expression1Expression2Difference
    turlVARIABLE_NAME_MISMATCH
    java.lang.Threadjava.net.URLVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Thread of variable t does not match with type java.net.URL of variable url
    • Make classes java.lang.Thread and java.net.URL extend a common superclass
    5
    if (url != null)
    11
    t.interrupt();
    11
    t.interrupt();
    6
    writeItem(url, context, writer);
    Differences
    Expression1Expression2Difference
    interruptwriteItemMETHOD_INVOCATION_NAME_MISMATCH
    t.interrupt()writeItem(url,context,writer)ARGUMENT_NUMBER_MISMATCH
    tMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression t.interrupt() is a void method call, and thus it cannot be parameterized
    Expression writeItem(url,context,writer) is a void method call, and thus it cannot be parameterized
    Expression t.interrupt() is a void method call, and thus it cannot be parameterized
    Expression writeItem(url,context,writer) is a void method call, and thus it cannot be parameterized
    6
    writeItem(url, context, writer);
    Precondition Violations (5)
    Row Violation
    1Type java.lang.Thread of variable t does not match with type java.net.URL of variable url
    2Expression t.interrupt() is a void method call, and thus it cannot be parameterized
    3Expression writeItem(url,context,writer) is a void method call, and thus it cannot be parameterized
    4Expression t.interrupt() is a void method call, and thus it cannot be parameterized
    5Expression writeItem(url,context,writer) is a void method call, and thus it cannot be parameterized