if (listenerSet != null && listenerSet.size() > 0) { Object[] listeners = listenerSet.toArray(); for (int i = 0; i < listeners.length; i++) { ((ActionListener) listeners[i]).actionPerformed(e); } }
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()); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/ActionRouter.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/control/ModuleController.java
Method name: void postActionPerformed(Class, ActionEvent) Method name: void setNodePath()
Number of AST nodes: 4 Number of AST nodes: 4
1
if (listenerSet != null && listenerSet.size() > 0) {
1
if (
2
				Object[] listeners = listenerSet.toArray
2
selectedNode != null) {
3
();
3
			TreeNode[] path = selectedNode.getPath();
4
				for (int i = 0; i < listeners.length; i++) {
4
			for (int i = 0; i < path.length; i++) {
5
					((ActionListener) listeners[i]).actionPerformed(e);
5
				nodePath.add(((JMeterTreeNode) path[i]).getName());
6
				}
6
			}
7
			
7
			// nodePath.add(selectedNode.getName());
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)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    if (listenerSet != null && listenerSet.size() > 0)
    3
    if (listenerSet != null && listenerSet.size() > 0)
    2
    if (selectedNode != null)
    Differences
    Expression1Expression2Difference
    &&!=OPERATOR_MISMATCH
    listenerSet != nullselectedNodeINFIX_LEFT_OPERAND_MISMATCH
    listenerSet.size() > 0nullINFIX_RIGHT_OPERAND_MISMATCH
    2
    if (selectedNode != null)
                                                                                        
    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
    3
    TreeNode[] path = selectedNode.getPath();
    4
    Object[] listeners = listenerSet.toArray();
    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
                                                                                            
    5
    for (int i = 0; i < listeners.length; i++)
    5
    for (int i = 0; i < listeners.length; i++)
    4
    for (int i = 0; i < path.length; i++)
    Differences
    Expression1Expression2Difference
    listenerspathVARIABLE_NAME_MISMATCH
    java.lang.Object[]javax.swing.tree.TreeNode[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable listeners.length does not match with type int of variable path.length
    • Make classes java.lang.Object[] and javax.swing.tree.TreeNode[] extend a common superclass
    4
    for (int i = 0; i < path.length; i++)
                                                                                                              
    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
    5
    nodePath.add(((JMeterTreeNode)path[i]).getName());
    6
    ((ActionListener)listeners[i]).actionPerformed(e);
    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
                                                                                                              
    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 listeners.length does not match with type int of variable path.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.gui.action.ActionRouter and org.apache.jmeter.control.ModuleController do not have a common superclass