if (isReference()) { return getCheckedRef().toString(); } if (cacheCollection().size() == 0) { return ""; } StringBuffer sb = new StringBuffer(); for (Iterator i = coll.iterator(); i.hasNext();) { if (sb.length() > 0) { sb.append(File.pathSeparatorChar); } sb.append(i.next()); } return sb.toString();
if (isReference()) { return getCheckedRef().toString(); } if (coll == null || coll.isEmpty()) { return ""; } StringBuffer sb = new StringBuffer(); for (Iterator i = coll.iterator(); i.hasNext();) { if (sb.length() > 0) { sb.append(File.pathSeparatorChar); } sb.append(i.next()); } return sb.toString();
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/Resources.java
Method name: String toString() Method name: String toString()
Number of AST nodes: 10 Number of AST nodes: 10
1
if (isReference()) {
1
if (isReference()) {
2
            return getCheckedRef().toString();
2
            return getCheckedRef().toString();
3
        }
3
        }
4
        if (cacheCollection().size() == 0) {
4
        if (coll == null || coll.isEmpty()) {
5
            return "";
5
            return "";
6
        }
6
        }
7
        StringBuffer sb = new StringBuffer();
7
        StringBuffer sb = new StringBuffer();
8
        for (Iterator i = coll.iterator(); i.hasNext();) {
8
        for (Iterator i = coll.iterator(); i.hasNext();) {
9
            if (sb.length() > 0) {
9
            if (sb.length() > 0) {
10
                sb.append(File.pathSeparatorChar);
10
                sb.append(File.pathSeparatorChar);
11
            }
11
            }
12
            sb.append(i.next());
12
            sb.append(i.next());
13
        }
13
        }
14
        return sb.toString();
14
        return sb.toString();
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 having the same super class
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)6.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (isReference())
    1
    if (isReference())
    2
    return getCheckedRef().toString();
    2
    return getCheckedRef().toString();
                                                                              
    3
    if (coll == null || coll.isEmpty())
                              
    4
    return "";
    Preondition Violations
    Unmatched return "";
    4
    return "";
    3
    if (cacheCollection().size() == 0)
                                                                            
    4
    return "";
    4
    return "";
    Preondition Violations
    Unmatched return "";
                              
    5
    StringBuffer sb = new StringBuffer();
    5
    StringBuffer sb = new StringBuffer();
    6
    for (Iterator i = coll.iterator(); i.hasNext(); )
    6
    for (Iterator i = coll.iterator(); i.hasNext(); )
    7
    if (sb.length() > 0)
    7
    if (sb.length() > 0)
    8
    sb.append(File.pathSeparatorChar);
    8
    sb.append(File.pathSeparatorChar);
    9
    sb.append(i.next());
    9
    sb.append(i.next());
    Precondition Violations (2)
    Row Violation
    1Unmatched return "";
    2Unmatched return "";