for (int i = 0; i < cnt; i++) { String match = mr.group(i); // treat non-matching groups as empty matches if (match == null) { match = ""; } v.addElement(match); } return v;
for (int i = 0; i < cnt; i++) { String match = reg.getParen(i); // treat non-matching groups as empty matches if (match == null) { match = ""; } v.addElement(match); } return v;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/JakartaOroMatcher.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/JakartaRegexpMatcher.java
Method name: Vector getGroups(String, int) Method name: Vector getGroups(String, int)
Number of AST nodes: 6 Number of AST nodes: 6
1
for (int i = 0; i < cnt; i++) {
1
for (int i = 0; i < cnt; i++) {
2
            String match = mr.group(i);
2
            String match = reg.getParen(i);
3
            // treat non-matching groups as empty matches
3
            // treat non-matching groups as empty matches
4
            if (match == null) {
4
            if (match == null) {
5
                match = "";
5
                match = "";
6
            }
6
            }
7
            v.addElement(match);
7
            v.addElement(match);
8
        }
8
        }
9
        return v;
9
        return v;
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.2
Clones locationClones are in different classes
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    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.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    for (int i = 0; i < cnt; i++)
    6
    for (int i = 0; i < cnt; i++)
                                                                    
    7
    String match = reg.getParen(i);
    Preondition Violations
    Unmatched statement String match=reg.getParen(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    String match = reg.getParen(i);
    7
    String match = mr.group(i);
    7
    String match = mr.group(i);
    Preondition Violations
    Unmatched statement String match=mr.group(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                            
    8
    if (match == null)
    8
    if (match == null)
    9
    match = "";
    9
    match = "";
    10
    v.addElement(match);
    10
    v.addElement(match);
    11
    return v;
    11
    return v;
    Precondition Violations (2)
    Row Violation
    1Unmatched statement String match=reg.getParen(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement String match=mr.group(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted