HTTPFileArg file = files[0]; if(!hasContentTypeHeader) { // Allow the mimetype of the file to control the content type if(file.getMimeType() != null && file.getMimeType().length() > 0) { connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType()); } else { connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED); } }
HTTPFileArg file = files[0]; if(!hasContentTypeHeader) { // Allow the mimetype of the file to control the content type if(file.getMimeType() != null && file.getMimeType().length() > 0) { post.setRequestHeader(HEADER_CONTENT_TYPE, file.getMimeType()); } else { post.setRequestHeader(HEADER_CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/PostWriter.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
Method name: void setHeaders(URLConnection, HTTPSampler) Method name: String sendPostData(PostMethod)
Number of AST nodes: 5 Number of AST nodes: 5
1
HTTPFileArg file = files[0];
1
HTTPFileArg file = files[0];
2
                if(!hasContentTypeHeader) {
2
                if(!hasContentTypeHeader) {
3
                    // Allow the mimetype of the file to control the content type
3
                    // Allow the mimetype of the file to control the content type
4
                    if(file.getMimeType() != null && file.getMimeType().length() > 0) {
4
                    if(file.getMimeType() != null && file.getMimeType().length() > 0) {
5
                        connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType());
5
                        post.setRequestHeader(HEADER_CONTENT_TYPE, file.getMimeType());
6
                    }
6
                    }
7
                    else {
7
                    else {
8
                        connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
8
                        post.setRequestHeader(HEADER_CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED);
9
                    }
9
                    }
10
                }
10
                }
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.5
Clones locationClones are in different classes
Number of node comparisons12
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    45
    HTTPFileArg file = files[0];
    44
    HTTPFileArg file = files[0];
    46
    if (!hasContentTypeHeader)
    45
    if (!hasContentTypeHeader)
    47
    if (file.getMimeType() != null && file.getMimeType().length() > 0)
    46
    if (file.getMimeType() != null && file.getMimeType().length() > 0)
                                                                                                                                        
    47
    post.setRequestHeader(HEADER_CONTENT_TYPE, file.getMimeType());
    Preondition Violations
    Unmatched statement post.setRequestHeader(HEADER_CONTENT_TYPE,file.getMimeType()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    47
    post.setRequestHeader(HEADER_CONTENT_TYPE, file.getMimeType());
    48
    connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType());
    48
    connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType());
    Preondition Violations
    Unmatched statement connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,file.getMimeType()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                                    
    else
            
                                                                                                                                                                      
    48
    post.setRequestHeader(HEADER_CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED);
    49
    connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
                                                                                                                                                                                                                                              
    Precondition Violations (2)
    Row Violation
    1Unmatched statement post.setRequestHeader(HEADER_CONTENT_TYPE,file.getMimeType()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,file.getMimeType()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted