if (port == null || port.length() == 0) { // it's not set, lets check if the user passed // proxy host and port from command line port = System.getProperty("http.proxyPort"); if (port != null) { this.setProxyPort(port); } }
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/protocol/http/sampler/WebServiceSampler.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/AjpSampler.java
Method name: void checkProxy() Method name: void parseHeaders(HTTPSampleResult)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (port == null || port.length() == 0) {
1
if
2
				// it's not set, lets check if the user passed
3
				// proxy host and port from command line
4
                port = System.getProperty("http.proxyPort");
5
				if (port != null) {
6
					this.setProxyPort(port);
7
				}
8
			
2
(HEADER_SET_COOKIE.equalsIgnoreCase(name)) {
3
                CookieManager cookies = getCookieManager();
4
                if(cookies != null) {
5
                    cookies.addCookieFromHeader(value, res.getURL());
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 having the same super class
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)29.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    10
    port = System.getProperty("http.proxyPort");
                                                                                                
                                                                                              
    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();
    11
    if (port != null)
    11
    if (port != null)
    21
    if (cookies != null)
    Differences
    Expression1Expression2Difference
    portcookiesVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.apache.jmeter.protocol.http.control.CookieManagerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable port does not match with type org.apache.jmeter.protocol.http.control.CookieManager of variable cookies
    • Make classes java.lang.String and org.apache.jmeter.protocol.http.control.CookieManager extend a common superclass
    21
    if (cookies != null)
    12
    this.setProxyPort(port);
    12
    this.setProxyPort(port);
    22
    cookies.addCookieFromHeader(value, res.getURL());
    Differences
    Expression1Expression2Difference
    setProxyPortaddCookieFromHeaderMETHOD_INVOCATION_NAME_MISMATCH
    thiscookiesTYPE_COMPATIBLE_REPLACEMENT
    this.setProxyPort(port)cookies.addCookieFromHeader(value,res.getURL())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression this.setProxyPort(port) 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 this.setProxyPort(port) 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
    22
    cookies.addCookieFromHeader(value, res.getURL());
    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 java.lang.String of variable port does not match with type org.apache.jmeter.protocol.http.control.CookieManager of variable cookies
    3Expression this.setProxyPort(port) is a void method call, and thus it cannot be parameterized
    4Expression cookies.addCookieFromHeader(value,res.getURL()) is a void method call, and thus it cannot be parameterized
    5Expression this.setProxyPort(port) is a void method call, and thus it cannot be parameterized
    6Expression cookies.addCookieFromHeader(value,res.getURL()) is a void method call, and thus it cannot be parameterized