CacheEntry entry = (CacheEntry) getCache().get(url.toString()); if (log.isDebugEnabled()){ log.debug(method.getName()+"(OAHC) "+url.toString()+" "+entry); } if (entry != null){ 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); } }
CacheEntry entry = (CacheEntry) getCache().get(url.toString()); if (log.isDebugEnabled()){ log.debug(conn.getRequestMethod()+"(Java) "+url.toString()+" "+entry); } if (entry != null){ 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: 10 Number of AST nodes: 10
1
CacheEntry entry = (CacheEntry) getCache().get(url.toString());
1
CacheEntry entry = (CacheEntry) getCache().get(url.toString());
2
        if (log.isDebugEnabled()){
2
        if (log.isDebugEnabled()){
3
            log.debug(method.getName()+"(OAHC) "+url.toString()+" "+entry);
3
            log.debug(conn.getRequestMethod()+"(Java) "+url.toString()+" "+entry);
4
        }
4
        }
5
        if (entry != null){
5
        if (entry != null){
6
            final String lastModified = entry.getLastModified();
6
            final String lastModified = entry.getLastModified();
7
            if (lastModified != null){
7
            if (lastModified != null){
8
                method.setRequestHeader(HTTPConstantsInterface.IF_MODIFIED_SINCE, lastModified);
8
                conn.addRequestProperty(HTTPConstantsInterface.IF_MODIFIED_SINCE, lastModified);
9
            }
9
            }
10
            final String etag = entry.getEtag();
10
            final String etag = entry.getEtag();
11
            if (etag != null){
11
            if (etag != null){
12
                method.setRequestHeader(HTTPConstantsInterface.IF_NONE_MATCH, etag);
12
                conn.addRequestProperty(HTTPConstantsInterface.IF_NONE_MATCH, etag);
13
            }
13
            }
14
        }
14
        }
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 declared in the same class
Number of node comparisons27
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)2.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    CacheEntry entry = (CacheEntry)getCache().get(url.toString());
    1
    CacheEntry entry = (CacheEntry)getCache().get(url.toString());
    2
    if (log.isDebugEnabled())
    2
    if (log.isDebugEnabled())
                                                                                                                                                                  
    3
    log.debug(conn.getRequestMethod() + "(Java) " + url.toString() + " " + entry);
    3
    log.debug(method.getName() + "(OAHC) " + url.toString() + " " + entry);
                                                                                                                                                    
    4
    if (entry != null)
    4
    if (entry != null)
    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 entry, lastModified, etag , while Clone fragment #2 returns variables entry, lastModified, etag