testChar = p_uriSpec.charAt(index); // check for valid escape sequence if (testChar == '%') { if (index+2 >= end || !isHex(p_uriSpec.charAt(index+1)) || !isHex(p_uriSpec.charAt(index+2))) { throw new MalformedURIException( "Path contains invalid escape sequence!"); } index += 2; } // Path segments cannot contain '[' or ']' since pchar // production was not changed by RFC 2732. else if (!isPathCharacter(testChar)) { if (testChar == '?' || testChar == '#') { break; } throw new MalformedURIException( "Path contains invalid character: " + testChar); } ++index;
testChar = p_uriSpec.charAt(index); if (testChar == '?' || testChar == '#') { break; } // check for valid escape sequence if (testChar == '%') { if (index+2 >= end || !isHex(p_uriSpec.charAt(index+1)) || !isHex(p_uriSpec.charAt(index+2))) { throw new MalformedURIException( "Opaque part contains invalid escape sequence!"); } index += 2; } // If the scheme specific part is opaque, it can contain '[' // and ']'. uric_no_slash wasn't modified by RFC 2732, which // I've interpreted as an error in the spec, since the // production should be equivalent to (uric - '/'), and uric // contains '[' and ']'. - mrglavas else if (!isURICharacter(testChar)) { throw new MalformedURIException( "Opaque part contains invalid character: " + testChar); } ++index;
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: void initializePath(String, int) Method name: void initializePath(String, int)
Number of AST nodes: 10 Number of AST nodes: 10
1
testChar = p_uriSpec.charAt(index);
1
testChar = p_uriSpec.charAt(index);
2
            
2
            
3
                if (testChar == '?' || testChar == '#') {
4
                    break;
5
                }
6
                
3
                // check for valid escape sequence
7
                // check for valid escape sequence
4
                if (testChar == '%') {
8
                if (testChar == '%') {
5
                    if (index+2 >= end ||
9
                    if (index+2 >= end ||
6
                    !isHex(p_uriSpec.charAt(index+1)) ||
10
                    !isHex(p_uriSpec.charAt(index+1)) ||
7
                    !isHex(p_uriSpec.charAt(index+2))) {
11
                    !isHex(p_uriSpec.charAt(index+2))) {
8
                        throw new MalformedURIException(
12
                        throw new MalformedURIException(
9
                            "Path contains invalid escape sequence!");
13
                            "Opaque part contains invalid escape sequence!");
10
                    }
14
                    }
11
                    index += 2;
15
                    index += 2;
12
                }
16
                }
13
                // Path segments cannot contain '[' or ']' since pchar
17
                // If the scheme specific part is opaque, it can contain '['
14
                // production was not changed by RFC 2732.
18
                // and ']'. uric_no_slash wasn't modified by RFC 2732, which
15
                else if (!isPathCharacter(testChar)) {
19
                
16
                    if (testChar == '?' || testChar ==
20
// I've interpreted as an error in the spec, since the 
17
 '#') {
21
                // production should be equivalent to (uric - '/'), and uric
18
                        break;
22
                
19
                    }
23
// contains '[' and ']'. - mrglavas
24
                else if (!isURICharacter(testChar)) {
20
                    throw new MalformedURIException(
25
                    throw new MalformedURIException(
21
                        "Path contains invalid character: " + testChar);
26
                        "Opaque part contains invalid character: " + testChar);
22
                }
27
                }
23
                ++index;
28
                ++index;
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.8
Clones locationClones are in the same method
Number of node comparisons9
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    12
    if (index + 2 >= end || !isHex(p_uriSpec.charAt(index + 1)) || !isHex(p_uriSpec.charAt(index + 2)))
    25
    if (index + 2 >= end || !isHex(p_uriSpec.charAt(index + 1)) || !isHex(p_uriSpec.charAt(index + 2)))
    13
    throw new MalformedURIException("Path contains invalid escape sequence!");
    13
    throw new MalformedURIException("Path contains invalid escape sequence!");
    26
    throw new MalformedURIException("Opaque part contains invalid escape sequence!");
    Differences
    Expression1Expression2Difference
    "Path contains invalid escape sequence!""Opaque part contains invalid escape sequence!"LITERAL_VALUE_MISMATCH
    26
    throw new MalformedURIException("Opaque part contains invalid escape sequence!");
    Precondition Violations (0)
    Row Violation