JMeterGUIComponent guiComp = guiPackage.getCurrentGui(); if (guiComp instanceof Clearable){ ((Clearable) guiComp).clearData(); }
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/gui/action/Clear.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Method name: void doAction(ActionEvent) Method name: void notifySampleListeners(SampleEvent)
Number of AST nodes: 3 Number of AST nodes: 4
1
JMeterGUIComponent guiComp = guiPackage.getCurrentGui
1
if (subNode.isEnabled()) {
2
();
2
				TestElement testElement = subNode.getTestElement();
3
			if (guiComp instanceof Clearable){
3
				if (testElement instanceof SampleListener) {
4
				((Clearable) guiComp).clearData();
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.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();
    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
                                                                                                                      
                                                                                                            
    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
    7
    TestElement testElement = subNode.getTestElement();
    5
    if (guiComp instanceof Clearable)
    5
    if (guiComp instanceof Clearable)
    8
    if (testElement instanceof SampleListener)
    Differences
    Expression1Expression2Difference
    guiComptestElementVARIABLE_NAME_MISMATCH
    org.apache.jmeter.gui.JMeterGUIComponentorg.apache.jmeter.testelement.TestElementVARIABLE_TYPE_MISMATCH
    org.apache.jmeter.samplers.Clearableorg.apache.jmeter.samplers.SampleListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.gui.JMeterGUIComponent of variable guiComp does not match with type org.apache.jmeter.testelement.TestElement of variable testElement
    • Make classes org.apache.jmeter.gui.JMeterGUIComponent and org.apache.jmeter.testelement.TestElement extend a common superclass
    Expression guiComp instanceof Clearable 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.samplers.Clearable does not match with type org.apache.jmeter.samplers.SampleListener
    • Make classes org.apache.jmeter.samplers.Clearable and org.apache.jmeter.samplers.SampleListener extend a common superclass
    8
    if (testElement instanceof SampleListener)
    6
    ((Clearable)guiComp).clearData();
    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
                                                                            
                                                                                                                  
    9
    ((SampleListener)testElement).sampleOccurred(event);
    Preondition Violations
    Unmatched statement ((SampleListener)testElement).sampleOccurred(event); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9
    ((SampleListener)testElement).sampleOccurred(event);
    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.gui.JMeterGUIComponent of variable guiComp does not match with type org.apache.jmeter.testelement.TestElement of variable testElement
    4Expression guiComp instanceof Clearable cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression testElement instanceof SampleListener cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type org.apache.jmeter.samplers.Clearable does not match with type org.apache.jmeter.samplers.SampleListener
    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 ((SampleListener)testElement).sampleOccurred(event); 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