while (srch.hasMore()) { // If there's anything left ... final SearchResult sr = (SearchResult) srch.next(); normaliseSearchDN(sr, searchBase, rootDn); writeSearchResult(sr, xmlb); }
while (srch.hasMore() && (sortedResults.size() < MAX_SORTED_RESULTS)) { final SearchResult sr = (SearchResult) srch.next(); // must be done prior to sorting normaliseSearchDN(sr, searchBase, rootDn); sortedResults.add(sr); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
Method name: void writeSearchResults(XMLBuffer, NamingEnumeration) Method name: void writeSearchResults(XMLBuffer, NamingEnumeration)
Number of AST nodes: 4 Number of AST nodes: 4
1
while (srch.hasMore()) { // If there's anything left ...
1
while (srch.hasMore()
2
        
2
 && (sortedResults.size() < MAX_SORTED_RESULTS)) {
3
    final SearchResult    sr = (SearchResult) srch.next();
3
			    final SearchResult    sr = (SearchResult) srch.next();
4
        
4
			        // must be done prior to sorting
5
    normaliseSearchDN(sr, searchBase, rootDn);
5
			    normaliseSearchDN(sr, searchBase, rootDn);
6
            writeSearchResult(sr, xmlb);
6
			    
7
        
7
sortedResults.add(sr);
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 in the same method
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    9
    while (srch.hasMore())
    9
    while (srch.hasMore())
    5
    while (srch.hasMore() && (sortedResults.size() < MAX_SORTED_RESULTS))
    Differences
    Expression1Expression2Difference
    srch.hasMore()srch.hasMore() && (sortedResults.size() < MAX_SORTED_RESULTS)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression srch.hasMore() && (sortedResults.size() < MAX_SORTED_RESULTS) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    while (srch.hasMore() && (sortedResults.size() < MAX_SORTED_RESULTS))
    10
    final SearchResult sr = (SearchResult)srch.next();
    6
    final SearchResult sr = (SearchResult)srch.next();
    11
    normaliseSearchDN(sr, searchBase, rootDn);
    7
    normaliseSearchDN(sr, searchBase, rootDn);
                                                      
    8
    sortedResults.add(sr);
    Preondition Violations
    Unmatched statement sortedResults.add(sr); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    sortedResults.add(sr);
    12
    writeSearchResult(sr, xmlb);
    12
    writeSearchResult(sr, xmlb);
    Preondition Violations
    Unmatched statement writeSearchResult(sr,xmlb); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement writeSearchResult(sr,xmlb); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                  
    Precondition Violations (4)
    Row Violation
    1Expression srch.hasMore() && (sortedResults.size() < MAX_SORTED_RESULTS) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Unmatched statement sortedResults.add(sr); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement writeSearchResult(sr,xmlb); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement writeSearchResult(sr,xmlb); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted