if (subNode.isEnabled()) { TestElement testElement = subNode.getTestElement(); if (testElement instanceof TestListener) { ((TestListener) testElement).testEnded(); } }
JMeterGUIComponent guiComp = guiPackage.getCurrentGui(); if (guiComp instanceof Clearable){ ((Clearable) guiComp).clearData(); }
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/gui/action/Clear.java
Method name: void notifyTestListenersOfEnd() Method name: void doAction(ActionEvent)
Number of AST nodes: 4 Number of AST nodes: 3
1
if (subNode.isEnabled()) {
2
				TestElement testElement = subNode.getTestElement();
1
JMeterGUIComponent guiComp = guiPackage.getCurrentGui();
3
				if (testElement instanceof TestListener) {
2
			if (guiComp instanceof Clearable){
4
					((TestListener) testElement).testEnded();
3
				((Clearable) guiComp).clearData();
5
				}
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.3
Clones locationClones are in different classes
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                      
    4
    JMeterGUIComponent guiComp = guiPackage.getCurrentGui();
    Preondition Violations
    Unmatched statement JMeterGUIComponent guiComp=guiPackage.getCurrentGui(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    JMeterGUIComponent guiComp = guiPackage.getCurrentGui();
    7
    TestElement testElement = subNode.getTestElement();
    7
    TestElement testElement = subNode.getTestElement();
    Preondition Violations
    Unmatched statement TestElement testElement=subNode.getTestElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                            
    8
    if (testElement instanceof TestListener)
    8
    if (testElement instanceof TestListener)
    5
    if (guiComp instanceof Clearable)
    Differences
    Expression1Expression2Difference
    testElementguiCompVARIABLE_NAME_MISMATCH
    org.apache.jmeter.testelement.TestElementorg.apache.jmeter.gui.JMeterGUIComponentVARIABLE_TYPE_MISMATCH
    org.apache.jmeter.testelement.TestListenerorg.apache.jmeter.samplers.ClearableVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.testelement.TestElement of variable testElement does not match with type org.apache.jmeter.gui.JMeterGUIComponent of variable guiComp
    • Make classes org.apache.jmeter.testelement.TestElement and org.apache.jmeter.gui.JMeterGUIComponent extend a common superclass
    Expression testElement instanceof TestListener cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression guiComp instanceof Clearable 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.Clearable
    • Make classes org.apache.jmeter.testelement.TestListener and org.apache.jmeter.samplers.Clearable extend a common superclass
    5
    if (guiComp instanceof Clearable)
                                                                            
    6
    ((Clearable)guiComp).clearData();
    Preondition Violations
    Unmatched statement ((Clearable)guiComp).clearData(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    ((Clearable)guiComp).clearData();
    9
    ((TestListener)testElement).testEnded();
    9
    ((TestListener)testElement).testEnded();
    Preondition Violations
    Unmatched statement ((TestListener)testElement).testEnded(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                          
    Precondition Violations (9)
    Row Violation
    1Unmatched statement JMeterGUIComponent guiComp=guiPackage.getCurrentGui(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement TestElement testElement=subNode.getTestElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.apache.jmeter.testelement.TestElement of variable testElement does not match with type org.apache.jmeter.gui.JMeterGUIComponent of variable guiComp
    4Expression testElement instanceof TestListener cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression guiComp instanceof Clearable cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type org.apache.jmeter.testelement.TestListener does not match with type org.apache.jmeter.samplers.Clearable
    7Unmatched statement ((Clearable)guiComp).clearData(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Unmatched statement ((TestListener)testElement).testEnded(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero