final String lastModified = entry.getLastModified(); if (lastModified != null){ method.setRequestHeader(HTTPConstantsInterface.IF_MODIFIED_SINCE, lastModified); } final String etag = entry.getEtag(); if (etag != null){ method.setRequestHeader(HTTPConstantsInterface.IF_NONE_MATCH, etag); }
final String lastModified = entry.getLastModified(); if (lastModified != null){ conn.addRequestProperty(HTTPConstantsInterface.IF_MODIFIED_SINCE, lastModified); } final String etag = entry.getEtag(); if (etag != null){ conn.addRequestProperty(HTTPConstantsInterface.IF_NONE_MATCH, etag); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/control/CacheManager.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/control/CacheManager.java
Method name: void setHeaders(URL, HttpMethod) Method name: void setHeaders(HttpURLConnection, URL)
Number of AST nodes: 6 Number of AST nodes: 6
1
final String lastModified = entry.getLastModified();
1
final String lastModified = entry.getLastModified();
2
            if (lastModified != null){
2
            if (lastModified != null){
3
                method.setRequestHeader(HTTPConstantsInterface.IF_MODIFIED_SINCE, lastModified);
3
                conn.addRequestProperty(HTTPConstantsInterface.IF_MODIFIED_SINCE, lastModified);
4
            }
4
            }
5
            final String etag = entry.getEtag();
5
            final String etag = entry.getEtag();
6
            if (etag != null){
6
            if (etag != null){
7
                method.setRequestHeader(HTTPConstantsInterface.IF_NONE_MATCH, etag);
7
                conn.addRequestProperty(HTTPConstantsInterface.IF_NONE_MATCH, etag);
8
            }
8
            }
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.3
Clones locationClones are declared in the same class
Number of node comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    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.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    5
    final String lastModified = entry.getLastModified();
    5
    final String lastModified = entry.getLastModified();
    6
    if (lastModified != null)
    6
    if (lastModified != null)
                                                                                                                                                                        
    7
    conn.addRequestProperty(HTTPConstantsInterface.IF_MODIFIED_SINCE, lastModified);
    Preondition Violations
    Unmatched statement conn.addRequestProperty(HTTPConstantsInterface.IF_MODIFIED_SINCE,lastModified); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7
    conn.addRequestProperty(HTTPConstantsInterface.IF_MODIFIED_SINCE, lastModified);
    7
    method.setRequestHeader(HTTPConstantsInterface.IF_MODIFIED_SINCE, lastModified);
    7
    method.setRequestHeader(HTTPConstantsInterface.IF_MODIFIED_SINCE, lastModified);
    Preondition Violations
    Unmatched statement method.setRequestHeader(HTTPConstantsInterface.IF_MODIFIED_SINCE,lastModified); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                        
    8
    final String etag = entry.getEtag();
    8
    final String etag = entry.getEtag();
    9
    if (etag != null)
    9
    if (etag != null)
                                                                                                                                                  
    10
    conn.addRequestProperty(HTTPConstantsInterface.IF_NONE_MATCH, etag);
    Preondition Violations
    Unmatched statement conn.addRequestProperty(HTTPConstantsInterface.IF_NONE_MATCH,etag); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    10
    conn.addRequestProperty(HTTPConstantsInterface.IF_NONE_MATCH, etag);
    10
    method.setRequestHeader(HTTPConstantsInterface.IF_NONE_MATCH, etag);
    10
    method.setRequestHeader(HTTPConstantsInterface.IF_NONE_MATCH, etag);
    Preondition Violations
    Unmatched statement method.setRequestHeader(HTTPConstantsInterface.IF_NONE_MATCH,etag); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                  
    Precondition Violations (5)
    Row Violation
    1Unmatched statement conn.addRequestProperty(HTTPConstantsInterface.IF_MODIFIED_SINCE,lastModified); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement method.setRequestHeader(HTTPConstantsInterface.IF_MODIFIED_SINCE,lastModified); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement conn.addRequestProperty(HTTPConstantsInterface.IF_NONE_MATCH,etag); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement method.setRequestHeader(HTTPConstantsInterface.IF_NONE_MATCH,etag); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Clone fragment #1 returns variables lastModified, etag , while Clone fragment #2 returns variables lastModified, etag