/** * Format this BaseResourceCollectionContainer as a String. * @return a descriptive <code>String</code>. */ public synchronized String 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(); }
/** * Format this Files collection as a String. * @return a descriptive <code>String</code>. */ public String toString() { // if (isReference()) { // return getRef().toString(); // } Iterator i = iterator(); // if (!i.hasNext()) { // return ""; // } StringBuffer sb = new StringBuffer(); while (i.hasNext()) { if (sb.length() > 0) { sb.append(File.pathSeparatorChar); } sb.append(i.next()); } return sb.toStr
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/Resources.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/Files.java
Method name: String toString() Method name: String toString()
Number of AST nodes: 4 Number of AST nodes: 4
1
/**
1
/**
2
     * Format this BaseResourceCollectionContainer as a String.
2
     * Format this Files collection as a String.
3
     * @return a descriptive <code>String</code>.
3
     * @return a descriptive <code>String</code>.
4
     */
4
     */
5
    public synchronized String toString() {
5
    public String toString() {
6
        if (isReference()) {
6
//        if (isReference()) {
7
            return getCheckedRef().toString();
7
//            return getRef().toString();
8
        }
8
//        }
9
        if (coll == null || coll.isEmpty()) {
9
        Iterator i = iterator();
10
            return "";
10
//        if (!i.hasNext()) {
11
        }
11
//            return "";
12
        StringBuffer sb = new StringBuffer();
12
//        }
13
        for (Iterator i = coll.iterator(); i.hasNext();) {
13
        StringBuffer sb = new StringBuffer();
14
            if (sb.length() > 0) {
14
        while (i.hasNext()) {
15
                sb.append(File.pathSeparatorChar);
15
            if (sb.length() > 0) {
16
            }
16
                sb.append(File.pathSeparatorChar);
17
            sb.append(i.next());
17
            }
18
        }
18
            sb.append(i.next());
19
        return sb.toString();
19
        }
20
    }
20
        return sb.toStr
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score1.000
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    6
    for (Iterator i = coll.iterator(); i.hasNext(); )
    3
    while (i.hasNext())
    7
    if (sb.length() > 0)
    4
    if (sb.length() > 0)
    8
    sb.append(File.pathSeparatorChar);
    5
    sb.append(File.pathSeparatorChar);
    9
    sb.append(i.next());
    6
    sb.append(i.next());
    Precondition Violations (0)
    Row Violation