if(HEADER_SET_COOKIE.equalsIgnoreCase(name)) { CookieManager cookies = getCookieManager(); if(cookies != null) { cookies.addCookieFromHeader(value, res.getURL()); } }
if (save.saveUrl()) { final URL url = res.getURL(); if (url != null) { writeItem(url, context, writer); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/AjpSampler.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/save/converters/SampleResultConverter.java
Method name: void parseHeaders(HTTPSampleResult) Method name: void saveSamplerData(HierarchicalStreamWriter, MarshallingContext, SampleResult, SampleSaveConfiguration)
Number of AST nodes: 4 Number of AST nodes: 4
1
if(HEADER_SET_COOKIE.equalsIgnoreCase(name)) {
1
if (save.saveUrl()) {
2
                CookieManager cookies = getCookieManager();
2
            final URL url = res.getURL();
3
                if(cookies != null) {
3
            if (url != null) {
4
                    cookies.addCookieFromHeader(value, res.getURL());
4
            	writeItem(url, context, writer);
5
                }
5
            
6
    
6
}
7
        }
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.2
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)22.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                
    4
    final URL url = res.getURL();
    20
    CookieManager cookies = getCookieManager();
    20
    CookieManager cookies = getCookieManager();
    Preondition Violations
    Unmatched statement CookieManager cookies=getCookieManager(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                              
    21
    if (cookies != null)
    21
    if (cookies != null)
    5
    if (url != null)
    Differences
    Expression1Expression2Difference
    cookiesurlVARIABLE_NAME_MISMATCH
    org.apache.jmeter.protocol.http.control.CookieManagerjava.net.URLVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.protocol.http.control.CookieManager of variable cookies does not match with type java.net.URL of variable url
    • Make classes org.apache.jmeter.protocol.http.control.CookieManager and java.net.URL extend a common superclass
    5
    if (url != null)
    22
    cookies.addCookieFromHeader(value, res.getURL());
    22
    cookies.addCookieFromHeader(value, res.getURL());
    6
    writeItem(url, context, writer);
    Differences
    Expression1Expression2Difference
    addCookieFromHeaderwriteItemMETHOD_INVOCATION_NAME_MISMATCH
    cookies.addCookieFromHeader(value,res.getURL())writeItem(url,context,writer)ARGUMENT_NUMBER_MISMATCH
    cookiesMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression cookies.addCookieFromHeader(value,res.getURL()) is a void method call, and thus it cannot be parameterized
    Expression writeItem(url,context,writer) is a void method call, and thus it cannot be parameterized
    Expression cookies.addCookieFromHeader(value,res.getURL()) is a void method call, and thus it cannot be parameterized
    Expression writeItem(url,context,writer) is a void method call, and thus it cannot be parameterized
    6
    writeItem(url, context, writer);
    Precondition Violations (6)
    Row Violation
    1Unmatched statement CookieManager cookies=getCookieManager(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Type org.apache.jmeter.protocol.http.control.CookieManager of variable cookies does not match with type java.net.URL of variable url
    3Expression cookies.addCookieFromHeader(value,res.getURL()) is a void method call, and thus it cannot be parameterized
    4Expression writeItem(url,context,writer) is a void method call, and thus it cannot be parameterized
    5Expression cookies.addCookieFromHeader(value,res.getURL()) is a void method call, and thus it cannot be parameterized
    6Expression writeItem(url,context,writer) is a void method call, and thus it cannot be parameterized