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
      }
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 comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    7
    if (index + 2 >= end || !isHex(authority.charAt(index + 1)) || !isHex(authority.charAt(index + 2)))
    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)))
    Differences
    Expression1Expression2Difference
    indexiVARIABLE_NAME_MISMATCH
    indexiVARIABLE_NAME_MISMATCH
    authorityp_uricVARIABLE_NAME_MISMATCH
    indexiVARIABLE_NAME_MISMATCH
    authorityp_uricVARIABLE_NAME_MISMATCH
    8
    if (i + 2 >= end || !isHex(p_uric.charAt(i + 1)) || !isHex(p_uric.charAt(i + 2)))
    8
    return false;
    8
    return false;
    9
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    9
    return false;
            
    else
                      
    10
    i += 2;
    Preondition Violations
    Unmatched statement i+=2; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    i += 2;
                              
    11
    continue;
    Preondition Violations
    Unmatched continue;
    11
    continue;
    Precondition Violations (4)
    Row Violation
    1Unmatched statement i+=2; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched continue;
    3Conditional return false;
    4Conditional return false;