if (now) { Thread t = (Thread) allThreadsSave.get(thrd); if (t != null) { t.interrupt(); } }
if(HEADER_SET_COOKIE.equalsIgnoreCase(name)) { CookieManager cookies = getCookieManager(); if(cookies != null) { cookies.addCookieFromHeader(value, res.getURL()); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/engine/StandardJMeterEngine.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/AjpSampler.java
Method name: boolean stopThread(String, boolean) Method name: void parseHeaders(HTTPSampleResult)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (now) {
1
if
2
				Thread t = (Thread) allThreadsSave.get(thrd);
3
				if (t != null) {
4
					t.interrupt();
5
				}
6
			
2
(HEADER_SET_COOKIE.equalsIgnoreCase(name)) {
3
                CookieManager cookies = getCookieManager();
4
                if(cookies != null) {
5
                    cookies.addCookieFromHeader(value, res.getURL());
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 comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    8
    if (now)
    8
    if (now)
    19
    if (HEADER_SET_COOKIE.equalsIgnoreCase(name))
    Differences
    Expression1Expression2Difference
    nowHEADER_SET_COOKIE.equalsIgnoreCase(name)TYPE_COMPATIBLE_REPLACEMENT
    19
    if (HEADER_SET_COOKIE.equalsIgnoreCase(name))
    9
    Thread t = (Thread)allThreadsSave.get(thrd);
                                                                                              
                                                                                              
    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
    20
    CookieManager cookies = getCookieManager();
    10
    if (t != null)
    10
    if (t != null)
    21
    if (cookies != null)
    Differences
    Expression1Expression2Difference
    tcookiesVARIABLE_NAME_MISMATCH
    java.lang.Threadorg.apache.jmeter.protocol.http.control.CookieManagerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Thread of variable t does not match with type org.apache.jmeter.protocol.http.control.CookieManager of variable cookies
    • Make classes java.lang.Thread and org.apache.jmeter.protocol.http.control.CookieManager extend a common superclass
    21
    if (cookies != null)
    11
    t.interrupt();
                                        
                                                                                                            
    22
    cookies.addCookieFromHeader(value, res.getURL());
    Precondition Violations (2)
    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 java.lang.Thread of variable t does not match with type org.apache.jmeter.protocol.http.control.CookieManager of variable cookies