synchronized (formEncodings) { String formEncoding = (String) formEncodings.get(urlWithoutQuery); // Form encoding has priority over page encoding if (formEncoding != null) { contentEncoding = formEncoding; } }
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/protocol/http/proxy/HttpRequestHdr.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/LoadRecentProject.java
Method name: void populateSampler(Map, Map) Method name: void updateRecentFileMenuItems(List, String)
Number of AST nodes: 4 Number of AST nodes: 4
1
synchronized (formEncodings) {
2
        
1
for(int i = 0; i < NUMBER_OF_MENU_ITEMS; i++) {
3
            String formEncoding = (String) formEncodings.get(urlWithoutQuery);
2
            String f
4
                    // Form encoding has priority over page encoding
5
                    if (formEncoding != null) {
6
                        contentEncoding = formEncoding;
7
        
3
ileName = (String)newRecentFiles.get(i);
4
            if(fileName != null) {
5
                setRecentFile(i, fileName);
8
            }
6
            }
9
                }
7
        }
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)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    35
    String formEncoding = (String)formEncodings.get(urlWithoutQuery);
    35
    String formEncoding = (String)formEncodings.get(urlWithoutQuery);
    12
    String fileName = (String)newRecentFiles.get(i);
    Differences
    Expression1Expression2Difference
    formEncodingfileNameVARIABLE_NAME_MISMATCH
    urlWithoutQueryiVARIABLE_NAME_MISMATCH
    java.lang.StringintVARIABLE_TYPE_MISMATCH
    formEncodingsnewRecentFilesVARIABLE_NAME_MISMATCH
    java.util.Mapjava.util.LinkedListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable urlWithoutQuery does not match with type int of variable i
    Type java.util.Map of variable formEncodings does not match with type java.util.LinkedList of variable newRecentFiles
    • Make classes java.util.Map and java.util.LinkedList extend a common superclass
    12
    String fileName = (String)newRecentFiles.get(i);
    36
    if (formEncoding != null)
    36
    if (formEncoding != null)
    13
    if (fileName != null)
    Differences
    Expression1Expression2Difference
    formEncodingfileNameVARIABLE_NAME_MISMATCH
    13
    if (fileName != null)
                                                                
    14
    setRecentFile(i, fileName);
    Preondition Violations
    Unmatched statement setRecentFile(i,fileName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14
    setRecentFile(i, fileName);
    37
    contentEncoding = formEncoding;
                                                                      
    Precondition Violations (3)
    Row Violation
    1Type java.lang.String of variable urlWithoutQuery does not match with type int of variable i
    2Type java.util.Map of variable formEncodings does not match with type java.util.LinkedList of variable newRecentFiles
    3Unmatched statement setRecentFile(i,fileName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted