if (subNode.isEnabled()) { TestElement testElement = subNode.getTestElement(); if (testElement instanceof TestListener) { ((TestListener) testElement).testStarted(); } }
if (subNode.isEnabled()) { TestElement testElement = subNode.getTestElement(); if (testElement instanceof SampleListener) { ((SampleListener) testElement).sampleOccurred(event); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/proxy/ProxyControl.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Method name: void notifyTestListenersOfStart() Method name: void notifySampleListeners(SampleEvent)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (subNode.isEnabled()) {
1
if (subNode.isEnabled()) {
2
				TestElement testElement = subNode.getTestElement();
2
				TestElement testElement = subNode.getTestElement();
3
				if (testElement instanceof TestListener) {
3
				if (testElement instanceof SampleListener) {
4
					((TestListener) testElement).testStarted();
4
					((SampleListener) testElement).sampleOccurred(event);
5
				}
5
				}
6
			}
6
			}
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.2
Clones locationClones are declared in the same class
Number of node comparisons9
  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)1.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    if (subNode.isEnabled())
    6
    if (subNode.isEnabled())
    7
    TestElement testElement = subNode.getTestElement();
    7
    TestElement testElement = subNode.getTestElement();
    8
    if (testElement instanceof TestListener)
    8
    if (testElement instanceof TestListener)
    8
    if (testElement instanceof SampleListener)
    Differences
    Expression1Expression2Difference
    org.apache.jmeter.testelement.TestListenerorg.apache.jmeter.samplers.SampleListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression testElement instanceof TestListener cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression testElement instanceof SampleListener cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.apache.jmeter.testelement.TestListener does not match with type org.apache.jmeter.samplers.SampleListener
    • Make classes org.apache.jmeter.testelement.TestListener and org.apache.jmeter.samplers.SampleListener extend a common superclass
    8
    if (testElement instanceof SampleListener)
                                                                                                                  
    9
    ((SampleListener)testElement).sampleOccurred(event);
    Preondition Violations
    Unmatched statement ((SampleListener)testElement).sampleOccurred(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    ((SampleListener)testElement).sampleOccurred(event);
    9
    ((TestListener)testElement).testStarted();
    9
    ((TestListener)testElement).testStarted();
    Preondition Violations
    Unmatched statement ((TestListener)testElement).testStarted(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                              
    Precondition Violations (5)
    Row Violation
    1Expression testElement instanceof TestListener cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression testElement instanceof SampleListener cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type org.apache.jmeter.testelement.TestListener does not match with type org.apache.jmeter.samplers.SampleListener
    4Unmatched statement ((SampleListener)testElement).sampleOccurred(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement ((TestListener)testElement).testStarted(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted