testChar = authority.charAt(index);
// check for valid escape sequence
if (testChar == '%') {
if (index+2 >= end ||
!isHex(authority.charAt(index+1)) ||
!isHex(authority.charAt(index+2))) {
return false;
}
index += 2;
}
// can check against path characters because the set
// is the same except for '/' which we've already excluded.
else if (!isPathCharacter(testChar)) {
return false;
}
++index;
testChar = p_uric.charAt(i);
if (testChar == '%') {
if (i+2 >= end ||
!isHex(p_uric.charAt(i+1)) ||
!isHex(p_uric.charAt(i+2))) {
return false;
}
else {
i += 2;
continue;
}
}
if (isURICharacter(testChar)) {
continue;
}
else {
return false;
}
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/DataValue.java
|
|
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/DataValue.java
|
Method name: boolean isValidRegistryBasedAuthority(String)
|
|
Method name: boolean isURIString(String)
|
Number of AST nodes: 8
|
|
Number of AST nodes: 9
|
|
1 | testChar = authority.charAt(index);↵ | | 1 | testChar = p_uric.charAt(i);↵
|
2 | ↵ | | |
|
3 | // check for valid escape sequence↵ | | |
|
4 | if (testChar == '%') {↵ | | 2 | if (testChar == '%') {↵
|
5 | if (index+2 >= end ||↵ | | 3 | if (i+2 >= end ||↵
|
6 | !isHex(authority.charAt(index+1)) ||↵ | | 4 | !isHex(p_uric.charAt(i+1)) ||↵
|
7 | !isHex(authority.charAt(index+2))) {↵ | | 5 | !isHex(p_uric.charAt(i+2))) {↵
|
8 | return false;↵ | | 6 | return false;↵
|
9 | }↵ | | 7 | }↵
|
10 | index += 2;↵ | | 8 | else {↵
|
11 | }↵ | | 9 | ↵
|
12 | // can check against path characters because the set↵ | | 10 | ↵
|
13 | // is the same except for '/' which we've already excluded.↵ | | 11 | i += 2;↵
|
| | | 12 | continue;↵
|
| | | 13 | }↵
|
| | | 14 | }↵
|
14 | else if (!isPathCharacter(testChar)) {↵ | | 15 | if (isURICharacter(testChar)) {↵
|
15 | return false;↵ | | 16 | continue;↵
|
16 | }↵ | | 17 | }↵
|
17 | ++index; | | 18 | else {↵
|
| | | 19 | return false;↵
|
| | | 20 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.6 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 9 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 0.7 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
7 | if (index + 2 >= end || !isHex(authority.charAt(index + 1)) || !isHex(authority.charAt(index + 2))) | | 8 | if (i + 2 >= end || !isHex(p_uric.charAt(i + 1)) || !isHex(p_uric.charAt(i + 2))) |
8 | | | 9 | |
| | | | |
| | | 10 | |
| | | 11 | |
Precondition Violations (4)
Row |
Violation |
1 | Unmatched statement i+=2; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched continue; |
3 | Conditional return false; |
4 | Conditional return false; |