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: 21 | Number of AST nodes: 21 | |||
1 | default:↵ | 1 | default:↵ | |
2 | {↵ | 2 | {↵ | |
3 | if (!XMLChar.isValid(ch))↵ | 3 | if (!XMLChar.isValid(ch))↵ | |
4 | {↵ | 4 | {↵ | |
5 | if (XMLChar.isHighSurrogate(ch))↵ | 5 | if (XMLChar.isHighSurrogate(ch))↵ | |
6 | {↵ | 6 | {↵ | |
7 | char high = ch;↵ | 7 | char high = ch;↵ | |
8 | if (inputLength-- > 0)↵ | 8 | if (inputLength-- > 0)↵ | |
9 | {↵ | 9 | {↵ | |
10 | ch = input.charAt(inputPos++); ↵ | 10 | ch = input.charAt(inputPos++); ↵ | |
11 | if (XMLChar.isLowSurrogate(ch))↵ | 11 | if (XMLChar.isLowSurrogate(ch))↵ | |
12 | {↵ | 12 | {↵ | |
13 | if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT)↵ | 13 | if (mappableLimit == MAX_UTF_MAPPABLE_CODEPOINT)↵ | |
14 | {↵ | 14 | {↵ | |
15 | // Every codepoint is supported! ↵ | 15 | // Every codepoint is supported! ↵ | |
16 | value[outputPos++] = high;↵ | 16 | value[outputPos++] = high;↵ | |
17 | value[outputPos++] = ch;↵ | 17 | value[outputPos++] = ch;↵ | |
18 | }↵ | 18 | }↵ | |
19 | else↵ | 19 | else↵ | |
20 | {↵ | 20 | {↵ | |
21 | // Produce the supplemental character as an entity↵ | 21 | // Produce the supplemental character as an entity↵ | |
22 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength);↵ | 22 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength);↵ | |
23 | changed = true;↵ | 23 | changed = true;↵ | |
24 | }↵ | 24 | }↵ | |
25 | break;↵ | 25 | break;↵ | |
26 | }↵ | 26 | }↵ | |
27 | throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);↵ | 27 | throw new RuntimeException("An invalid low surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);↵ | |
28 | }↵ | 28 | }↵ | |
29 | else↵ | 29 | else↵ | |
30 | {↵ | 30 | {↵ | |
31 | throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);↵ | 31 | throw new RuntimeException("An unpaired high surrogate character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);↵ | |
32 | }↵ | 32 | }↵ | |
33 | }↵ | 33 | }↵ | |
34 | else↵ | 34 | else↵ | |
35 | {↵ | 35 | {↵ | |
36 | throw new RuntimeException("An invalid XML character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);↵ | 36 | throw new RuntimeException("An invalid XML character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input);↵ | |
37 | }↵ | 37 | }↵ | |
38 | }↵ | 38 | }↵ | |
39 | else↵ | 39 | else↵ | |
40 | {↵ | 40 | {↵ | |
41 | // Normal (BMP) unicode code point. See if we know for a fact that the encoding supports it:↵ | 41 | // Normal (BMP) unicode code point. See if we know for a fact that the encoding supports it:↵ | |
42 | if (ch <= mappableLimit)↵ | 42 | if (ch <= mappableLimit)↵ | |
43 | {↵ | 43 | {↵ | |
44 | value[outputPos++] = ch;↵ | 44 | value[outputPos++] = ch;↵ | |
45 | }↵ | 45 | }↵ | |
46 | else↵ | 46 | else↵ | |
47 | {↵ | 47 | {↵ | |
48 | // We not sure the encoding supports this code point, so we write it as a character entity reference.↵ | 48 | // We not sure the encoding supports this code point, so we write it as a character entity reference.↵ | |
49 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(ch) + ";").toCharArray(), inputLength);↵ | 49 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(ch) + ";").toCharArray(), inputLength);↵ | |
50 | changed = true;↵ | 50 | changed = true;↵ | |
51 | }↵ | 51 | }↵ | |
52 | }↵ | 52 | }↵ | |
53 | break; | 53 |
| |
See real code fragment | See real code fragment |
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) | 1.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 79 |
Number of mapped statements | 21 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 13.3 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
67 | default: | 70 | default: | |
68 | if (!XMLChar.isValid(ch)) | 71 | if (!XMLChar.isValid(ch)) | |
69 | if (XMLChar.isHighSurrogate(ch)) | 72 | if (XMLChar.isHighSurrogate(ch)) | |
70 | char high = ch; | 73 | char high = ch; | |
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, ("" + Integer.toHexString(XMLChar.supplemental(high, ch)) + ";").toCharArray(), inputLength); | 80 | outputPos = replaceChars(outputPos, ("" + 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); | |
else | else | |||
82 | throw new RuntimeException("An invalid XML character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); | 85 | throw new RuntimeException("An invalid XML character (Unicode: 0x" + Integer.toHexString(ch) + ") was found in the element content:" + input); | |
else | else | |||
83 | if (ch <= mappableLimit) | 86 | if (ch <= mappableLimit) | |
84 | value[outputPos++] = ch; | 87 | value[outputPos++] = ch; | |
else | else | |||
85 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(ch) + ";").toCharArray(), inputLength); | 88 | outputPos = replaceChars(outputPos, ("" + Integer.toHexString(ch) + ";").toCharArray(), inputLength); | |
86 | changed = true; | 89 | changed = true; | |
87 | break; | 90 | break; |
Row | Violation |
---|---|
1 | Clone fragment #1 returns variables inputLength, inputPos, outputPos, changed , while Clone fragment #2 returns variables inputLength, inputPos, outputPos, changed |