if (testElement instanceof HTTPSamplerBase) { HTTPSamplerBase base = (HTTPSamplerBase) testElement; tableModel.clearData(); HTTPFileArg[] files = base.getHTTPFiles(); for(int i=0; i< files.length; i++){ tableModel.addRow(files[i]); } checkDeleteAndBrowseStatus(); }
editMenu.removeAll(); Component[] comps = menu.getComponents(); for (int i = 0; i < comps.length; i++) { editMenu.add(comps[i]); } editMenu.setEnabled(true);
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/ReportMenuBar.java
Method name: void configure(TestElement) Method name: void setEditMenu(JPopupMenu)
Number of AST nodes: 7 Number of AST nodes: 5
1
if (testElement instanceof HTTPSamplerBase) {
2
            HTTPSamplerBase base = (HTTPSamplerBase) testElement;
3
            tableModel.clearData();
4
            HTTPFileArg[] files = base.getHTTPFiles();
5
            
1
editMenu.removeAll();
2
			Component[] comps = menu.getComponents();
6
for(int i=0; i< files.length; i++){
3
			for (int i = 0; i < comps.length; i++) {
7
                tableModel.addRow(files[i]);            
8
            }
9
            checkDeleteAndBrowseStatus();
10
        }
4
				editMenu.add(comps[i]);
5
			}
6
			editMenu.setEnabled(true);
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 having the same super class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    2
    HTTPSamplerBase base = (HTTPSamplerBase)testElement;
                                                                                                              
                                                                                        
    3
    Component[] comps = menu.getComponents();
    3
    tableModel.clearData();
                                                        
    4
    HTTPFileArg[] files = base.getHTTPFiles();
                                                                                          
    5
    for (int i = 0; i < files.length; i++)
    5
    for (int i = 0; i < files.length; i++)
    4
    for (int i = 0; i < comps.length; i++)
    Differences
    Expression1Expression2Difference
    filescompsVARIABLE_NAME_MISMATCH
    org.apache.jmeter.protocol.http.util.HTTPFileArg[]java.awt.Component[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.protocol.http.util.HTTPFileArg[] of variable files does not match with type java.awt.Component[] of variable comps
    • Make classes org.apache.jmeter.protocol.http.util.HTTPFileArg[] and java.awt.Component[] extend a common superclass
    4
    for (int i = 0; i < comps.length; i++)
                                                        
    5
    editMenu.add(comps[i]);
    Preondition Violations
    Unmatched statement editMenu.add(comps[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    editMenu.add(comps[i]);
    6
    tableModel.addRow(files[i]);
    6
    tableModel.addRow(files[i]);
    Preondition Violations
    Unmatched statement tableModel.addRow(files[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                  
    7
    checkDeleteAndBrowseStatus();
    7
    checkDeleteAndBrowseStatus();
    2
    editMenu.removeAll();
    Differences
    Expression1Expression2Difference
    checkDeleteAndBrowseStatusremoveAllMETHOD_INVOCATION_NAME_MISMATCH
    editMenuMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression checkDeleteAndBrowseStatus() is a void method call, and thus it cannot be parameterized
    Expression editMenu.removeAll() is a void method call, and thus it cannot be parameterized
    Expression checkDeleteAndBrowseStatus() is a void method call, and thus it cannot be parameterized
    Expression editMenu.removeAll() is a void method call, and thus it cannot be parameterized
    2
    editMenu.removeAll();
                                                              
    6
    editMenu.setEnabled(true);
    Precondition Violations (7)
    Row Violation
    1Type org.apache.jmeter.protocol.http.util.HTTPFileArg[] of variable files does not match with type java.awt.Component[] of variable comps
    2Unmatched statement editMenu.add(comps[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement tableModel.addRow(files[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Expression checkDeleteAndBrowseStatus() is a void method call, and thus it cannot be parameterized
    5Expression editMenu.removeAll() is a void method call, and thus it cannot be parameterized
    6Expression checkDeleteAndBrowseStatus() is a void method call, and thus it cannot be parameterized
    7Expression editMenu.removeAll() is a void method call, and thus it cannot be parameterized