for(int i = 0; i < partNo; i++) { if(parts[i] instanceof ViewableFilePart) { ((ViewableFilePart) parts[i]).setHideFileData(true); // .sendMultipartWithoutFileContent(bos); } }
for (int i = 0; i < trustmanagers.length; i++) { if (trustmanagers[i] instanceof X509TrustManager) { trustmanagers[i] = new CustomX509TrustManager( (X509TrustManager)trustmanagers[i]); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/util/JsseSSLManager.java
Method name: String sendPostData(PostMethod) Method name: SSLContext createContext()
Number of AST nodes: 3 Number of AST nodes: 3
1
for(int i = 0; i < partNo; i++) {
1
for (int i = 0; i < trustmanagers.length; i++) {
2
                	if(parts[i] instanceof ViewableFilePart) {
2
            
3
                		((ViewableFilePart) parts[i]).setHideFileData(true); // .sendMultipartWithoutFileContent(bos);
4
                    }
3
if (trustmanagers[i] instanceof X509TrustManager) {
4
                trustmanagers[i] = new CustomX509TrustManager(
5
                    (X509TrustManager)trustmanagers[i]); 
5
        
6
            }
6
        }
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.4
Clones locationClones are in different classes
Number of node comparisons7
  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)13.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    29
    for (int i = 0; i < partNo; i++)
    29
    for (int i = 0; i < partNo; i++)
    17
    for (int i = 0; i < trustmanagers.length; i++)
    Differences
    Expression1Expression2Difference
    partNotrustmanagers.lengthTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression trustmanagers.length cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17
    for (int i = 0; i < trustmanagers.length; i++)
    30
    if (parts[i] instanceof ViewableFilePart)
    30
    if (parts[i] instanceof ViewableFilePart)
    18
    if (trustmanagers[i] instanceof X509TrustManager)
    Differences
    Expression1Expression2Difference
    partstrustmanagersVARIABLE_NAME_MISMATCH
    org.apache.commons.httpclient.methods.multipart.Part[]javax.net.ssl.TrustManager[]VARIABLE_TYPE_MISMATCH
    org.apache.jmeter.protocol.http.sampler.HTTPSampler2.ViewableFilePartjavax.net.ssl.X509TrustManagerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.commons.httpclient.methods.multipart.Part[] of variable parts does not match with type javax.net.ssl.TrustManager[] of variable trustmanagers
    • Make classes org.apache.commons.httpclient.methods.multipart.Part[] and javax.net.ssl.TrustManager[] extend a common superclass
    Expression parts[i] instanceof ViewableFilePart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression trustmanagers[i] instanceof X509TrustManager cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.apache.jmeter.protocol.http.sampler.HTTPSampler2.ViewableFilePart does not match with type javax.net.ssl.X509TrustManager
    • Make classes org.apache.jmeter.protocol.http.sampler.HTTPSampler2.ViewableFilePart and javax.net.ssl.X509TrustManager extend a common superclass
    18
    if (trustmanagers[i] instanceof X509TrustManager)
                                                                                                                                                                            
    19
    trustmanagers[i] = new CustomX509TrustManager((X509TrustManager)trustmanagers[i]);
    Preondition Violations
    Unmatched statement trustmanagers[i]=new CustomX509TrustManager((X509TrustManager)trustmanagers[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    19
    trustmanagers[i] = new CustomX509TrustManager((X509TrustManager)trustmanagers[i]);
    31
    ((ViewableFilePart)parts[i]).setHideFileData(true);
    31
    ((ViewableFilePart)parts[i]).setHideFileData(true);
    Preondition Violations
    Unmatched statement ((ViewableFilePart)parts[i]).setHideFileData(true); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                  
    Precondition Violations (8)
    Row Violation
    1Expression trustmanagers.length cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Type org.apache.commons.httpclient.methods.multipart.Part[] of variable parts does not match with type javax.net.ssl.TrustManager[] of variable trustmanagers
    3Expression parts[i] instanceof ViewableFilePart cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression trustmanagers[i] instanceof X509TrustManager cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type org.apache.jmeter.protocol.http.sampler.HTTPSampler2.ViewableFilePart does not match with type javax.net.ssl.X509TrustManager
    6Unmatched statement trustmanagers[i]=new CustomX509TrustManager((X509TrustManager)trustmanagers[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement ((ViewableFilePart)parts[i]).setHideFileData(true); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8The refactoring of the clones is infeasible, because classes org.apache.jmeter.protocol.http.sampler.HTTPSampler2 and org.apache.jmeter.util.JsseSSLManager do not have a common superclass