TestElement testElement = node.getTestElement(); if (testElement.canRemove()) { ReportGuiPackage.getInstance().getTreeModel().removeNodeFromParent( node); ReportGuiPackage.getInstance().removeNode(testElement); } else { String message = testElement.getClass().getName() + " is busy"; JOptionPane.showMessageDialog(null, message, "Cannot remove item", JOptionPane.ERROR_MESSAGE); }
TestElement testElement = node.getTestElement(); if (testElement.canRemove()) { GuiPackage.getInstance().getTreeModel().removeNodeFromParent(node); GuiPackage.getInstance().removeNode(testElement); } else { String message = testElement.getClass().getName() + " is busy"; JOptionPane.showMessageDialog(null, message, "Cannot remove item", JOptionPane.ERROR_MESSAGE); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/report/gui/action/ReportRemove.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/Remove.java
Method name: void removeNode(ReportTreeNode) Method name: void removeNode(JMeterTreeNode)
Number of AST nodes: 6 Number of AST nodes: 6
1
TestElement testElement = node.getTestElement();
1
TestElement testElement = node.getTestElement();
2
		if (testElement.canRemove()) {
2
		if (testElement.canRemove()) {
3
			ReportGuiPackage.getInstance().getTreeModel().removeNodeFromParent(
3
			GuiPackage.getInstance().getTreeModel().removeNodeFromParent(
4
					node);
4
node);
5
			ReportGuiPackage.getInstance().removeNode(testElement);
5
			GuiPackage.getInstance().removeNode(testElement);
6
		} else {
6
		} else {
7
			String message = testElement.getClass().getName() + " is busy";
7
			String message = testElement.getClass().getName() + " is busy";
8
			JOptionPane.showMessageDialog(null, message, "Cannot remove item",
8
			JOptionPane.showMessageDialog(null, message, "Cannot remove item",
9
					JOptionPane.ERROR_MESSAGE);
9
 JOptionPane.ERROR_MESSAGE);
10
		}
10
		}
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 comparisons26
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    TestElement testElement = node.getTestElement();
    1
    TestElement testElement = node.getTestElement();
    1
    TestElement testElement = node.getTestElement();
    Differences
    Expression1Expression2Difference
    org.apache.jmeter.report.gui.tree.ReportTreeNodeorg.apache.jmeter.gui.tree.JMeterTreeNodeSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression node cannot be unified with expression node , because common superclass javax.swing.tree.DefaultMutableTreeNode does not declare member(s) public org.apache.jmeter.testelement.TestElement getTestElement()
    1
    TestElement testElement = node.getTestElement();
    2
    if (testElement.canRemove())
    2
    if (testElement.canRemove())
    3
    ReportGuiPackage.getInstance().getTreeModel().removeNodeFromParent(node);
    3
    ReportGuiPackage.getInstance().getTreeModel().removeNodeFromParent(node);
    3
    GuiPackage.getInstance().getTreeModel().removeNodeFromParent(node);
    Differences
    Expression1Expression2Difference
    org.apache.jmeter.report.gui.tree.ReportTreeNodeorg.apache.jmeter.gui.tree.JMeterTreeNodeSUBCLASS_TYPE_MISMATCH
    org.apache.jmeter.gui.ReportGuiPackageorg.apache.jmeter.gui.GuiPackageSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression node cannot be unified with expression node , because common superclass type javax.swing.tree.DefaultMutableTreeNode cannot be passed as an argument to public void removeNodeFromParent(org.apache.jmeter.report.gui.tree.ReportTreeNode)
    Expression ReportGuiPackage cannot be unified with expression GuiPackage , because common superclass org.apache.jmeter.util.LocaleChangeListener does not declare member(s) public static org.apache.jmeter.gui.ReportGuiPackage getInstance() , public static org.apache.jmeter.gui.GuiPackage getInstance() , public org.apache.jmeter.report.gui.tree.ReportTreeModel getTreeModel() , public org.apache.jmeter.gui.tree.JMeterTreeModel getTreeModel()
    3
    GuiPackage.getInstance().getTreeModel().removeNodeFromParent(node);
    4
    ReportGuiPackage.getInstance().removeNode(testElement);
    4
    ReportGuiPackage.getInstance().removeNode(testElement);
    4
    GuiPackage.getInstance().removeNode(testElement);
    Differences
    Expression1Expression2Difference
    org.apache.jmeter.gui.ReportGuiPackageorg.apache.jmeter.gui.GuiPackageSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression ReportGuiPackage cannot be unified with expression GuiPackage , because common superclass org.apache.jmeter.util.LocaleChangeListener does not declare member(s) public static org.apache.jmeter.gui.ReportGuiPackage getInstance() , public static org.apache.jmeter.gui.GuiPackage getInstance() , public void removeNode(org.apache.jmeter.testelement.TestElement)
    4
    GuiPackage.getInstance().removeNode(testElement);
    else
    else
    5
    String message = testElement.getClass().getName() + " is busy";
    5
    String message = testElement.getClass().getName() + " is busy";
    6
    JOptionPane.showMessageDialog(null, message, "Cannot remove item", JOptionPane.ERROR_MESSAGE);
    6
    JOptionPane.showMessageDialog(null, message, "Cannot remove item", JOptionPane.ERROR_MESSAGE);
    Precondition Violations (4)
    Row Violation
    1Expression node cannot be unified with expression node , because common superclass javax.swing.tree.DefaultMutableTreeNode does not declare member(s) public org.apache.jmeter.testelement.TestElement getTestElement()
    2Expression node cannot be unified with expression node , because common superclass type javax.swing.tree.DefaultMutableTreeNode cannot be passed as an argument to public void removeNodeFromParent(org.apache.jmeter.report.gui.tree.ReportTreeNode)
    3Expression ReportGuiPackage cannot be unified with expression GuiPackage , because common superclass org.apache.jmeter.util.LocaleChangeListener does not declare member(s) public static org.apache.jmeter.gui.ReportGuiPackage getInstance() , public static org.apache.jmeter.gui.GuiPackage getInstance() , public org.apache.jmeter.report.gui.tree.ReportTreeModel getTreeModel() , public org.apache.jmeter.gui.tree.JMeterTreeModel getTreeModel()
    4Expression ReportGuiPackage cannot be unified with expression GuiPackage , because common superclass org.apache.jmeter.util.LocaleChangeListener does not declare member(s) public static org.apache.jmeter.gui.ReportGuiPackage getInstance() , public static org.apache.jmeter.gui.GuiPackage getInstance() , public void removeNode(org.apache.jmeter.testelement.TestElement)