if (str == null) { return ""; } StringBuffer result = new StringBuffer(); int pos = 0; char ch; while (pos < str.length()) { ch = str.charAt(pos); if (ch == '<') { result.append("<"); } else if (ch == '>') { result.append(">"); } else { result.append(ch); } pos++; } return result.toString();
if (str == null) { return ""; } StringBuffer result = new StringBuffer(); int pos = 0; char ch; while (pos < str.length()) { ch = str.charAt(pos); if (ch == '<') { result.append("<"); } else if (ch == '>') { result.append(">"); } else { result.append(ch); } pos++; } return result.toString();
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/util/ToolTipFactory.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/contact/list/HeaderItemToolTipFactory.java
Method name: String convert(String) Method name: String convert(String)
Number of AST nodes: 14 Number of AST nodes: 14
1
if (str == null) {
1
if (str == null) {
2
			return "";
2
			return "";
3
		}
3
		}
4
		StringBuffer result = new StringBuffer();
4
		StringBuffer result = new StringBuffer();
5
		int pos = 0;
5
		int pos = 0;
6
		char ch;
6
		char ch;
7
		while (pos < str.length()) {
7
		while (pos < str.length()) {
8
			ch = str.charAt(pos);
8
			ch = str.charAt(pos);
9
			if (ch == '<') {
9
			if (ch == '<') {
10
				result.append("<");
10
				result.append("<");
11
			} else if (ch == '>') {
11
			} else if (ch == '>') {
12
				result.append(">");
12
				result.append(">");
13
			} else {
13
			} else {
14
				result.append(ch);
14
				result.append(ch);
15
			}
15
			}
16
			pos++;
16
			pos++;
17
		}
17
		}
18
		return result.toString();
18
		return result.toString();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.6
Clones locationClones are in different classes
Number of node comparisons41
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)7.4
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    1
    if (str == null)
    1
    if (str == null)
    2
    return "";
    2
    return "";
    3
    StringBuffer result = new StringBuffer();
    3
    StringBuffer result = new StringBuffer();
    4
    int pos = 0;
    4
    int pos = 0;
    5
    char ch;
    5
    char ch;
    6
    while (pos < str.length())
    6
    while (pos < str.length())
    7
    ch = str.charAt(pos);
    7
    ch = str.charAt(pos);
    8
    if (ch == '<')
    8
    if (ch == '<')
    9
    result.append("<");
    9
    result.append("<");
    10
    else if (ch == '>')
    10
    else if (ch == '>')
    11
    result.append(">");
    11
    result.append(">");
    else
    else
    12
    result.append(ch);
    12
    result.append(ch);
    13
    pos++;
    13
    pos++;
    14
    return result.toString();
    14
    return result.toString();
    Precondition Violations (0)
    Row Violation