int s2 = withLinkMatcher.start(); int e2 = withLinkMatcher.end(); if ((s2 < s1) && (e2 > e1)) { // same email adress - just append and continue buf.append(s.substring(pos, e2)); pos = e2; insertLink = false; // already handled } else { // not the same insertLink = true; }
int s2 = withLinkMatcher.start(); int e2 = withLinkMatcher.end(); if ((s2 < s1) && (e2 > e1)) { // same url - just append and continue buf.append(s.substring(pos, e2)); pos = e2; insertLink = false; // already handled } else { // not the same insertLink = true; }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/parser/text/HtmlParser.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/parser/text/HtmlParser.java
Method name: String substituteEmailAddress(String, boolean) Method name: String substituteURL(String, boolean)
Number of AST nodes: 7 Number of AST nodes: 7
1
int s2 = withLinkMatcher.start();
1
int s2 = withLinkMatcher.start();
2
                    int e2 = withLinkMatcher.end();
2
                    int e2 = withLinkMatcher.end();
3
                    
4
                    if ((s2 < s1) && (e2 > e1)) {
3
                    if ((s2 < s1) && (e2 > e1)) {
5
                        // same email adress - just append and continue
4
                        // same url - just append and continue
6
                        buf.append(s.substring(pos, e2));
5
                        buf.append(s.substring(pos, e2));
7
                        pos = e2;
6
                        pos = e2;
8
                        insertLink = false; // already handled
7
                        insertLink = false; // already handled
9
                    } else {
8
                    } else {
10
                        // not the same
9
                        // not the same
11
                        insertLink = true;
10
                        insertLink = true;
12
                    }
11
                    }
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 declared in the same class
Number of node comparisons31
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.0
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    14
    int s2 = withLinkMatcher.start();
    14
    int s2 = withLinkMatcher.start();
    15
    int e2 = withLinkMatcher.end();
    15
    int e2 = withLinkMatcher.end();
    16
    if ((s2 < s1) && (e2 > e1))
    16
    if ((s2 < s1) && (e2 > e1))
    17
    buf.append(s.substring(pos, e2));
    17
    buf.append(s.substring(pos, e2));
    18
    pos = e2;
    18
    pos = e2;
    19
    insertLink = false;
    19
    insertLink = false;
    else
    else
    20
    insertLink = true;
    20
    insertLink = true;
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables pos, insertLink , while Clone fragment #2 returns variables pos, insertLink