if (el != null) { super.addTestElement(el); log.info("TestElement: " + el.getClass().getName()); }
for(int i = 0; i < NUMBER_OF_MENU_ITEMS; i++) { String fileName = (String)newRecentFiles.get(i); if(fileName != null) { setRecentFile(i, fileName); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/testelement/AbstractTable.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/LoadRecentProject.java
Method name: void addTestElement(TestElement) Method name: void updateRecentFileMenuItems(List, String)
Number of AST nodes: 3 Number of AST nodes: 4
1
if (el != null) {
2
            super.addTestElement(el);
3
            log.info("TestElement: " + el.getClass().getName());
1
for(int i = 0; i < NUMBER_OF_MENU_ITEMS; i++) {
2
            String fileName = (String)newRecentFiles.get(i);
3
            if(fileName != null) {
4
                setRecentFile(i, fileName);
5
            }
4
        }
6
        }
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.1
Clones locationClones are in different classes
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)25.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                        
    12
    String fileName = (String)newRecentFiles.get(i);
    Preondition Violations
    Unmatched statement String fileName=(String)newRecentFiles.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12
    String fileName = (String)newRecentFiles.get(i);
    1
    if (el != null)
    1
    if (el != null)
    13
    if (fileName != null)
    Differences
    Expression1Expression2Difference
    elfileNameVARIABLE_NAME_MISMATCH
    org.apache.jmeter.testelement.TestElementjava.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.testelement.TestElement of variable el does not match with type java.lang.String of variable fileName
    • Make classes org.apache.jmeter.testelement.TestElement and java.lang.String extend a common superclass
    13
    if (fileName != null)
    2
    super.addTestElement(el);
    2
    super.addTestElement(el);
    14
    setRecentFile(i, fileName);
    Differences
    Expression1Expression2Difference
    super.addTestElement(el)setRecentFile(i,fileName)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression super.addTestElement(el) is a void method call, and thus it cannot be parameterized
    Expression setRecentFile(i,fileName) is a void method call, and thus it cannot be parameterized
    14
    setRecentFile(i, fileName);
    3
    log.info("TestElement: " + el.getClass().getName());
                                                                                                                  
    Precondition Violations (4)
    Row Violation
    1Unmatched statement String fileName=(String)newRecentFiles.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Type org.apache.jmeter.testelement.TestElement of variable el does not match with type java.lang.String of variable fileName
    3Expression super.addTestElement(el) is a void method call, and thus it cannot be parameterized
    4Expression setRecentFile(i,fileName) is a void method call, and thus it cannot be parameterized