if (node != null) { Object usrobj = node.getUserObject(); if (usrobj instanceof MonitorModel) { GRAPH.updateGui((MonitorModel) usrobj); } }
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/visualizers/MonitorPerformancePanel.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Method name: void addSample(MonitorModel) Method name: void notifySampleListeners(SampleEvent)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (node != null) {
1
if (
2
			Object usrobj = node.getUserObjec
2
subNode.isEnabled()) {
3
t();
3
				TestElement testElement = subNode.getTestElement();
4
			if (usrobj instanceof MonitorModel) {
4
				if (testElement instanceof 
5
				GRAPH.updateGui((MonitorModel) usrobj
5
SampleListener) {
6
);
6
					((SampleListener) testElement).sampleOccurred(event);
7
			}
7
				}
8
		}
8
			}
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 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.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                            
    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();
    9
    Object usrobj = node.getUserObject();
                                                                                
    10
    if (usrobj instanceof MonitorModel)
    10
    if (usrobj instanceof MonitorModel)
    8
    if (testElement instanceof SampleListener)
    Differences
    Expression1Expression2Difference
    usrobjtestElementVARIABLE_NAME_MISMATCH
    java.lang.Objectorg.apache.jmeter.testelement.TestElementVARIABLE_TYPE_MISMATCH
    org.apache.jmeter.visualizers.MonitorModelorg.apache.jmeter.samplers.SampleListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Object of variable usrobj does not match with type org.apache.jmeter.testelement.TestElement of variable testElement
    • Make classes java.lang.Object and org.apache.jmeter.testelement.TestElement extend a common superclass
    Expression usrobj instanceof MonitorModel 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.visualizers.MonitorModel does not match with type org.apache.jmeter.samplers.SampleListener
    • Make classes org.apache.jmeter.visualizers.MonitorModel 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 the extracted code, because it has control dependencies from statements that will be extracted
    9
    ((SampleListener)testElement).sampleOccurred(event);
    11
    GRAPH.updateGui((MonitorModel)usrobj);
    11
    GRAPH.updateGui((MonitorModel)usrobj);
    Preondition Violations
    Unmatched statement GRAPH.updateGui((MonitorModel)usrobj); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                        
    Precondition Violations (8)
    Row Violation
    1Unmatched 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
    2Type java.lang.Object of variable usrobj does not match with type org.apache.jmeter.testelement.TestElement of variable testElement
    3Expression usrobj instanceof MonitorModel cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression testElement instanceof SampleListener cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type org.apache.jmeter.visualizers.MonitorModel does not match with type org.apache.jmeter.samplers.SampleListener
    6Unmatched statement ((SampleListener)testElement).sampleOccurred(event); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched statement GRAPH.updateGui((MonitorModel)usrobj); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero