if (selectedNode != null) { TreeNode[] path = selectedNode.getPath(); for (int i = 0; i < path.length; i++) { nodePath.add(((JMeterTreeNode) path[i]).getName()); } // nodePath.add(selectedNode.getName()); }
if (listenerSet != null && listenerSet.size() > 0) { Object[] listeners = listenerSet.toArray(); for (int i = 0; i < listeners.length; i++) { ((ActionListener) listeners[i]).actionPerformed(e); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/control/ModuleController.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/ActionRouter.java
Method name: void setNodePath() Method name: void preActionPerformed(Class, ActionEvent)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (selectedNode != null) {
1
if (
2
			TreeNode[] path = selectedNode.getPath
2
listenerSet != null && listenerSet.size() > 0) {
3
();
3
				Object[] listeners = listenerSet.toArray();
4
			for (int i = 0; i < path.length; i++) {
4
				for (int i = 0; i < listeners.length; i++) {
5
				nodePath.add(((JMeterTreeNode) path[i]).getName());
5
					((ActionListener) listeners[i]).actionPerformed(e);
6
			}
6
				}
7
			// nodePath.add(selectedNode.getName());
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.3
Clones locationClones are in different classes
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (selectedNode != null)
    2
    if (selectedNode != null)
    3
    if (listenerSet != null && listenerSet.size() > 0)
    Differences
    Expression1Expression2Difference
    !=&&OPERATOR_MISMATCH
    selectedNodelistenerSet != nullINFIX_LEFT_OPERAND_MISMATCH
    nulllistenerSet.size() > 0INFIX_RIGHT_OPERAND_MISMATCH
    3
    if (listenerSet != null && listenerSet.size() > 0)
    3
    TreeNode[] path = selectedNode.getPath();
    3
    TreeNode[] path = selectedNode.getPath();
    Preondition Violations
    Unmatched statement TreeNode[] path=selectedNode.getPath(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                        
                                                                                            
    4
    Object[] listeners = listenerSet.toArray();
    Preondition Violations
    Unmatched statement Object[] listeners=listenerSet.toArray(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    Object[] listeners = listenerSet.toArray();
    4
    for (int i = 0; i < path.length; i++)
    4
    for (int i = 0; i < path.length; i++)
    5
    for (int i = 0; i < listeners.length; i++)
    Differences
    Expression1Expression2Difference
    pathlistenersVARIABLE_NAME_MISMATCH
    javax.swing.tree.TreeNode[]java.lang.Object[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable path.length does not match with type int of variable listeners.length
    • Make classes javax.swing.tree.TreeNode[] and java.lang.Object[] extend a common superclass
    5
    for (int i = 0; i < listeners.length; i++)
    5
    nodePath.add(((JMeterTreeNode)path[i]).getName());
    5
    nodePath.add(((JMeterTreeNode)path[i]).getName());
    Preondition Violations
    Unmatched statement nodePath.add(((JMeterTreeNode)path[i]).getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                              
                                                                                                              
    6
    ((ActionListener)listeners[i]).actionPerformed(e);
    Preondition Violations
    Unmatched statement ((ActionListener)listeners[i]).actionPerformed(e); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    ((ActionListener)listeners[i]).actionPerformed(e);
    Precondition Violations (6)
    Row Violation
    1Unmatched statement TreeNode[] path=selectedNode.getPath(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement Object[] listeners=listenerSet.toArray(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Type int of variable path.length does not match with type int of variable listeners.length
    4Unmatched statement nodePath.add(((JMeterTreeNode)path[i]).getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement ((ActionListener)listeners[i]).actionPerformed(e); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6The refactoring of the clones is infeasible, because classes org.apache.jmeter.control.ModuleController and org.apache.jmeter.gui.action.ActionRouter do not have a common superclass