if(auth != null) { String authHeader = auth.getAuthHeaderForURL(url); if(authHeader != null) { ++hsz; } }
if (authManager != null) { Authorization auth = authManager.getAuthForURL(u); if (auth != null) { conn.setRequestProperty(HEADER_AUTHORIZATION, auth.toBasicHeader()); } }
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/protocol/http/sampler/HTTPSampler.java
Method name: int getHeaderSize(String, URL) Method name: void setConnectionAuthorization(HttpURLConnection, URL, AuthManager)
Number of AST nodes: 4 Number of AST nodes: 4
1
if(auth != null) {
1
if (authManager != null) {
2
                String authHeader = auth.getAuthHeaderForURL(url);
2
			Authorization auth = authManager.getAuthForURL(u);
3
            if(authHeader != null) {
3
			if (auth != null) {
4
            ++hsz;
5
            }
6
        
4
				conn.setRequestProperty(HEADER_AUTHORIZATION, auth.toBasicHeader());
5
			}
7
}
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons8
  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)2.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    14
    if (auth != null)
    14
    if (auth != null)
    1
    if (authManager != null)
    Differences
    Expression1Expression2Difference
    authauthManagerVARIABLE_NAME_MISMATCH
    1
    if (authManager != null)
                                                                                                          
    2
    Authorization auth = authManager.getAuthForURL(u);
    Preondition Violations
    Unmatched statement Authorization auth=authManager.getAuthForURL(u); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2
    Authorization auth = authManager.getAuthForURL(u);
    15
    String authHeader = auth.getAuthHeaderForURL(url);
    15
    String authHeader = auth.getAuthHeaderForURL(url);
    Preondition Violations
    Unmatched statement String authHeader=auth.getAuthHeaderForURL(url); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                            
    16
    if (authHeader != null)
    16
    if (authHeader != null)
    3
    if (auth != null)
    Differences
    Expression1Expression2Difference
    authHeaderauthVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.apache.jmeter.protocol.http.control.AuthorizationVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable authHeader does not match with type org.apache.jmeter.protocol.http.control.Authorization of variable auth
    • Make classes java.lang.String and org.apache.jmeter.protocol.http.control.Authorization extend a common superclass
    3
    if (auth != null)
                                                                                                                                                
    4
    conn.setRequestProperty(HEADER_AUTHORIZATION, auth.toBasicHeader());
    Preondition Violations
    Unmatched statement conn.setRequestProperty(HEADER_AUTHORIZATION,auth.toBasicHeader()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    conn.setRequestProperty(HEADER_AUTHORIZATION, auth.toBasicHeader());
    17
    ++hsz;
                        
    Precondition Violations (4)
    Row Violation
    1Unmatched statement Authorization auth=authManager.getAuthForURL(u); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement String authHeader=auth.getAuthHeaderForURL(url); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Type java.lang.String of variable authHeader does not match with type org.apache.jmeter.protocol.http.control.Authorization of variable auth
    4Unmatched statement conn.setRequestProperty(HEADER_AUTHORIZATION,auth.toBasicHeader()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted