if (!XMLChar.isValid(ch)) { if (XMLChar.isHighSurrogate(ch)) { char high = ch; 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); } } else { throw new RuntimeException("An invalid XML character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); } } else { // Normal (BMP) unicode code point. See if we know for a fact that the encoding supports it: if (ch <= mappableLimit) { value[outputPos++] = ch; } else { // We not sure the encoding supports this code point, so we write it as a character entity reference. outputPos = replaceChars(outputPos, ("&#x" + Integer.toHexString(ch) + ";").toCharArray(), inputLength); changed = true; } } break;
if (!XMLChar.isValid(ch)) { if (XMLChar.isHighSurrogate(ch)) { char high = ch; 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); } } else { throw new RuntimeException("An invalid XML character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); } } else { // Normal (BMP) unicode code point. See if we know for a fact that the encoding supports it: if (ch <= mappableLimit) { value[outputPos++] = ch; } else { // We not sure the encoding supports this code point, so we write it as a character entity reference. outputPos = replaceChars(outputPos, ("&#x" + Integer.toHexString(ch) + ";").toCharArray(), inputLength); changed = true; } } break;
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: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
if (!XMLChar.isValid(ch))
1
if (!XMLChar.isValid(ch))
2
            {
2
            {
3
              if (XMLChar.isHighSurrogate(ch))
3
              if (XMLChar.isHighSurrogate(ch))
4
              {
4
              {
5
                char high = ch;
5
                char high = ch;
6
                if (inputLength-- > 0)
6
                if (inputLength-- > 0)
7
                {
7
                {
8
                  ch = input.charAt(inputPos++); 
8
                  ch = input.charAt(inputPos++); 
9
                  if (XMLChar.isLowSurrogate(ch))
9
                  if (XMLChar.isLowSurrogate(ch))
10
                  {
10
                  {
11
                    if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT)
11
                    if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT)
12
                    {
12
                    {
13
                      // Every codepoint is supported! 
13
                      // Every codepoint is supported! 
14
                      value[outputPos++] = high;
14
                      value[outputPos++] = high;
15
                      value[outputPos++] = ch;
15
                      value[outputPos++] = ch;
16
                    }
16
                    }
17
                    else
17
                    else
18
                    {
18
                    {
19
                      // Produce the supplemental character as an entity
19
                      // Produce the supplemental character as an entity
20
                      outputPos = replaceChars(outputPos, ("&#x" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength);
20
                      outputPos = replaceChars(outputPos, ("&#x" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength);
21
                      changed = true;
21
                      changed = true;
22
                    }
22
                    }
23
                    break;
23
                    break;
24
                  }
24
                  }
25
                  throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
25
                  throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
26
                }
26
                }
27
                else
27
                else
28
                {
28
                {
29
                  throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
29
                  throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
30
                }
30
                }
31
              }
31
              }
32
              else
32
              else
33
              {
33
              {
34
                throw new RuntimeException("An invalid XML character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
34
                throw new RuntimeException("An invalid XML character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);
35
              }
35
              }
36
            }
36
            }
37
            else
37
            else
38
            {
38
            {
39
              // Normal (BMP) unicode code point. See if we know for a fact that the encoding supports it:
39
              // Normal (BMP) unicode code point. See if we know for a fact that the encoding supports it:
40
              if (ch <= mappableLimit)
40
              if (ch <= mappableLimit)
41
              {
41
              {
42
                value[outputPos++] = ch;
42
                value[outputPos++] = ch;
43
              }
43
              }
44
              else
44
              else
45
              {
45
              {
46
                // We not sure the encoding supports this code point, so we write it as a character entity reference.
46
                // We not sure the encoding supports this code point, so we write it as a character entity reference.
47
                outputPos = replaceChars(outputPos, ("&#x" + Integer.toHexString(ch) + ";").toCharArray(), inputLength);
47
                outputPos = replaceChars(outputPos, ("&#x" + Integer.toHexString(ch) + ";").toCharArray(), inputLength);
48
                changed = true;
48
                changed = true;
49
              }
49
              }
50
            }
50
            }
51
            break;
51
            break;
52
          
52
          
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0