334:66c7161ee588 | 371:e324dfb90c9e |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this | 7 * published by the Free Software Foundation. Oracle designates this |
69 (byte)'D', | 69 (byte)'D', |
70 (byte)'E', | 70 (byte)'E', |
71 (byte)'F', | 71 (byte)'F', |
72 }; | 72 }; |
73 | 73 |
74 // Legal IDL Identifier characters (1 = legal). Note | |
75 // that '.' (2E) is marked as legal even though it is | |
76 // not legal in IDL. This allows us to treat a fully | |
77 // qualified Java name with '.' package separators | |
78 // uniformly, and is safe because that is the only | |
79 // legal use of '.' in a Java name. | |
80 | |
81 private static final byte[] IDL_IDENTIFIER_CHARS = { | |
82 | |
83 // 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
84 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f | |
85 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 10-1f | |
86 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, // 20-2f | |
87 1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 30-3f | |
88 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 40-4f | |
89 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 50-5f | |
90 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 60-6f | |
91 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 70-7f | |
92 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 80-8f | |
93 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 90-9f | |
94 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // a0-af | |
95 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // b0-bf | |
96 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // c0-cf | |
97 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // d0-df | |
98 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // e0-ef | |
99 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // f0-ff | |
100 }; | |
101 | |
74 //_____________________________________________________________________ | 102 //_____________________________________________________________________ |
75 // Public Interfaces | 103 // Public Interfaces |
76 //_____________________________________________________________________ | 104 //_____________________________________________________________________ |
77 | 105 |
78 /** | 106 /** |
137 | 165 |
138 String result = replace(name,"x\\u","U"); | 166 String result = replace(name,"x\\u","U"); |
139 result = replace(result,"x\\U","U"); | 167 result = replace(result,"x\\U","U"); |
140 | 168 |
141 // Now see if we have any remaining illegal characters (see | 169 // Now see if we have any remaining illegal characters (see |
142 // RepositoryId.IDL_IDENTIFIER_CHARS array)... | 170 // IDL_IDENTIFIER_CHARS array)... |
143 | 171 |
144 int length = result.length(); | 172 int length = result.length(); |
145 StringBuffer buffer = null; | 173 StringBuffer buffer = null; |
146 | 174 |
147 for (int i = 0; i < length; i++) { | 175 for (int i = 0; i < length; i++) { |
148 | 176 |
149 char c = result.charAt(i); | 177 char c = result.charAt(i); |
150 | 178 |
151 if (c > 255 || RepositoryId.IDL_IDENTIFIER_CHARS[c] == 0) { | 179 if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) { |
152 | 180 |
153 // We gotta convert. Have we already started? | 181 // We gotta convert. Have we already started? |
154 | 182 |
155 if (buffer == null) { | 183 if (buffer == null) { |
156 | 184 |