String str = url; int i = str.indexOf("//"); // $NON-NLS-1$ if (i > 0) { str = str.substring(i + 2); } // chop to server.name:xx i = str.indexOf("/"); // $NON-NLS-1$ if (0 < i) { str = str.substring(0, i); } // chop to server.name i = str.indexOf(":");
String str = url; // chop to "server.name:x/thing" int i = str.indexOf("//"); if (i > 0) { str = str.substring(i + 2); } // chop to server.name:xx i = str.indexOf("/"); if (0 < i) { str = str.substring(0, i); } // chop XX i = str.indexOf(":");
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java
Method name: String serverName() Method name: int serverPort()
Number of AST nodes: 8 Number of AST nodes: 8
1
String str = url;
1
String str = url;
2
		
2
		// chop to "server.name:x/thing"
3
int i = str.indexOf("//"); // $NON-NLS-1$
3
		int i = str.indexOf("//");
4
		if (i > 0) {
4
		if (i > 0) {
5
			str = str.substring(i + 2);
5
			str = str.substring(i + 2);
6
		}
6
		}
7
		// chop to server.name:xx
7
		// chop to server.name:xx
8
		i = str.indexOf("/"); // $NON-NLS-1$
8
		i = str.indexOf("/");
9
		if (0 < i) {
9
		if (0 < i) {
10
			str = str.substring(0, i);
10
			str = str.substring(0, i);
11
		}
11
		}
12
		// chop to server.name
12
		// chop XX
13
		i = str.indexOf(":");
13
		i = str.indexOf(":");
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.6
Clones locationClones are declared in the same class
Number of node comparisons26
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    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.6
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    1
    String str = url;
    1
    String str = url;
    2
    int i = str.indexOf("//");
    2
    int i = str.indexOf("//");
    3
    if (i > 0)
    3
    if (i > 0)
    4
    str = str.substring(i + 2);
    4
    str = str.substring(i + 2);
    5
    i = str.indexOf("/");
    5
    i = str.indexOf("/");
    6
    if (0 < i)
    6
    if (0 < i)
    7
    str = str.substring(0, i);
    7
    str = str.substring(0, i);
    8
    i = str.indexOf(":");
    8
    i = str.indexOf(":");
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables i, str , while Clone fragment #2 returns variables i, str