if (inputLength-- > 0) { ch = input.charAt(inputPos++); if (XMLChar.isLowSurrogate(ch)) { if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT) { // Every codepoint is supported! value[outputPos++] = high; value[outputPos++] = ch; } else { // Produce the supplemental character as an entity outputPos = replaceChars(outputPos, ("&#x" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength); changed = true; } break; } throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); } else { throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); }
if (inputLength-- > 0) { ch = input.charAt(inputPos++); if (XMLChar.isLowSurrogate(ch)) { if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT) { // Every codepoint is supported! value[outputPos++] = high; value[outputPos++] = ch; } else { // Produce the supplemental character as an entity outputPos = replaceChars(outputPos, ("&#x" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength); changed = true; } break; } throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); } else { throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLSaveImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLSaveImpl.java
Method name: String convert(String) Method name: String convertText(String)
Number of AST nodes: 11 Number of AST nodes: 11
1
if (inputLength-- > 0)
1
if (inputLength-- > 0)
2
                {
2
                {
3
                  ch = input.charAt(inputPos++); 
3
                  ch = input.charAt(inputPos++); 
4
                  if (XMLChar.isLowSurrogate(ch))
4
                  if (XMLChar.isLowSurrogate(ch))
5
                  {
5
                  {
6
                    if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT)
6
                    if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT)
7
                    {
7
                    {
8
                      // Every codepoint is supported! 
8
                      // Every codepoint is supported! 
9
                      value[outputPos++] = high;
9
                      value[outputPos++] = high;
10
                      value[outputPos++] = ch;
10
                      value[outputPos++] = ch;
11
                    }
11
                    }
12
                    else
12
                    else
13
                    {
13
                    {
14
                      // Produce the supplemental character as an entity
14
                      // Produce the supplemental character as an entity
15
                      outputPos = replaceChars(outputPos, ("&#x" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength);
15
                      outputPos = replaceChars(outputPos, ("&#x" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength);
16
                      changed = true;
16
                      changed = true;
17
                    }
17
                    }
18
                    break;
18
                    break;
19
                  }
19
                  }
20
                  throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
20
                  throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
21
                }
21
                }
22
                else
22
                else
23
                {
23
                {
24
                  throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
24
                  throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
25
                }
25
                }
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 comparisons47
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)8.4
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    71
    if (inputLength-- > 0)
    74
    if (inputLength-- > 0)
    72
    ch = input.charAt(inputPos++);
    75
    ch = input.charAt(inputPos++);
    73
    if (XMLChar.isLowSurrogate(ch))
    76
    if (XMLChar.isLowSurrogate(ch))
    74
    if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT)
    77
    if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT)
    75
    value[outputPos++] = high;
    78
    value[outputPos++] = high;
    76
    value[outputPos++] = ch;
    79
    value[outputPos++] = ch;
    else
    else
    77
    outputPos = replaceChars(outputPos, ("&#x" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength);
    80
    outputPos = replaceChars(outputPos, ("&#x" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength);
    78
    changed = true;
    81
    changed = true;
    79
    break;
    82
    break;
    80
    throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
    83
    throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
    else
    else
    81
    throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
    84
    throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables inputLength, inputPos, outputPos, changed , while Clone fragment #2 returns variables inputLength, inputPos, outputPos, changed