Mon, 02 Oct 2017 14:20:23 +0100
8159240: XSOM parser incorrectly processes type names with whitespaces
Reviewed-by: coffeys
1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 /* this file is generated by RelaxNGCC */
27 package com.sun.xml.internal.xsom.impl.parser.state;
28 import com.sun.xml.internal.bind.WhiteSpaceProcessor;
29 import com.sun.xml.internal.xsom.impl.*;
30 import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
31 import com.sun.xml.internal.xsom.parser.*;
33 import org.xml.sax.Attributes;
34 import org.xml.sax.Locator;
35 import org.xml.sax.SAXException;
37 class attributeGroupDecl extends NGCCHandler {
38 private AnnotationImpl annotation;
39 private String name;
40 private ForeignAttributesImpl fa;
41 protected final NGCCRuntimeEx $runtime;
42 private int $_ngcc_current_state;
43 protected String $uri;
44 protected String $localName;
45 protected String $qname;
47 public final NGCCRuntime getRuntime() {
48 return($runtime);
49 }
51 public attributeGroupDecl(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
52 super(source, parent, cookie);
53 $runtime = runtime;
54 $_ngcc_current_state = 14;
55 }
57 public attributeGroupDecl(NGCCRuntimeEx runtime) {
58 this(null, runtime, runtime, -1);
59 }
61 private void action0()throws SAXException {
63 result = new AttGroupDeclImpl(
64 $runtime.document, annotation, locator, fa, name );
66 }
68 private void action1()throws SAXException {
69 locator=$runtime.copyLocator();
70 }
72 public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
73 int $ai;
74 $uri = $__uri;
75 $localName = $__local;
76 $qname = $__qname;
77 switch($_ngcc_current_state) {
78 case 6:
79 {
80 if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("anyAttribute")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attribute")))))) {
81 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 246, fa);
82 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
83 }
84 else {
85 unexpectedEnterElement($__qname);
86 }
87 }
88 break;
89 case 13:
90 {
91 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
92 $runtime.consumeAttribute($ai);
93 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
94 }
95 else {
96 unexpectedEnterElement($__qname);
97 }
98 }
99 break;
100 case 0:
101 {
102 revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
103 }
104 break;
105 case 7:
106 {
107 if(($ai = $runtime.getAttributeIndex("","id"))>=0) {
108 $runtime.consumeAttribute($ai);
109 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
110 }
111 else {
112 $_ngcc_current_state = 6;
113 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
114 }
115 }
116 break;
117 case 3:
118 {
119 action0();
120 $_ngcc_current_state = 2;
121 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
122 }
123 break;
124 case 2:
125 {
126 if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("anyAttribute")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attribute"))))) {
127 NGCCHandler h = new attributeUses(this, super._source, $runtime, 241, result);
128 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
129 }
130 else {
131 unexpectedEnterElement($__qname);
132 }
133 }
134 break;
135 case 14:
136 {
137 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
138 $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
139 action1();
140 $_ngcc_current_state = 13;
141 }
142 else {
143 unexpectedEnterElement($__qname);
144 }
145 }
146 break;
147 case 4:
148 {
149 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
150 NGCCHandler h = new annotation(this, super._source, $runtime, 244, null,AnnotationContext.ATTRIBUTE_GROUP);
151 spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
152 }
153 else {
154 $_ngcc_current_state = 3;
155 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
156 }
157 }
158 break;
159 default:
160 {
161 unexpectedEnterElement($__qname);
162 }
163 break;
164 }
165 }
167 public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
168 int $ai;
169 $uri = $__uri;
170 $localName = $__local;
171 $qname = $__qname;
172 switch($_ngcc_current_state) {
173 case 6:
174 {
175 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
176 NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 246, fa);
177 spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
178 }
179 else {
180 unexpectedLeaveElement($__qname);
181 }
182 }
183 break;
184 case 1:
185 {
186 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
187 $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
188 $_ngcc_current_state = 0;
189 }
190 else {
191 unexpectedLeaveElement($__qname);
192 }
193 }
194 break;
195 case 13:
196 {
197 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
198 $runtime.consumeAttribute($ai);
199 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
200 }
201 else {
202 unexpectedLeaveElement($__qname);
203 }
204 }
205 break;
206 case 0:
207 {
208 revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
209 }
210 break;
211 case 7:
212 {
213 if(($ai = $runtime.getAttributeIndex("","id"))>=0) {
214 $runtime.consumeAttribute($ai);
215 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
216 }
217 else {
218 $_ngcc_current_state = 6;
219 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
220 }
221 }
222 break;
223 case 3:
224 {
225 action0();
226 $_ngcc_current_state = 2;
227 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
228 }
229 break;
230 case 2:
231 {
232 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("attributeGroup"))) {
233 NGCCHandler h = new attributeUses(this, super._source, $runtime, 241, result);
234 spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
235 }
236 else {
237 unexpectedLeaveElement($__qname);
238 }
239 }
240 break;
241 case 4:
242 {
243 $_ngcc_current_state = 3;
244 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
245 }
246 break;
247 default:
248 {
249 unexpectedLeaveElement($__qname);
250 }
251 break;
252 }
253 }
255 public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
256 int $ai;
257 $uri = $__uri;
258 $localName = $__local;
259 $qname = $__qname;
260 switch($_ngcc_current_state) {
261 case 13:
262 {
263 if(($__uri.equals("") && $__local.equals("name"))) {
264 $_ngcc_current_state = 12;
265 }
266 else {
267 unexpectedEnterAttribute($__qname);
268 }
269 }
270 break;
271 case 0:
272 {
273 revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
274 }
275 break;
276 case 7:
277 {
278 if(($__uri.equals("") && $__local.equals("id"))) {
279 $_ngcc_current_state = 9;
280 }
281 else {
282 $_ngcc_current_state = 6;
283 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
284 }
285 }
286 break;
287 case 3:
288 {
289 action0();
290 $_ngcc_current_state = 2;
291 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
292 }
293 break;
294 case 4:
295 {
296 $_ngcc_current_state = 3;
297 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
298 }
299 break;
300 default:
301 {
302 unexpectedEnterAttribute($__qname);
303 }
304 break;
305 }
306 }
308 public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
309 int $ai;
310 $uri = $__uri;
311 $localName = $__local;
312 $qname = $__qname;
313 switch($_ngcc_current_state) {
314 case 0:
315 {
316 revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
317 }
318 break;
319 case 7:
320 {
321 $_ngcc_current_state = 6;
322 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
323 }
324 break;
325 case 3:
326 {
327 action0();
328 $_ngcc_current_state = 2;
329 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
330 }
331 break;
332 case 8:
333 {
334 if(($__uri.equals("") && $__local.equals("id"))) {
335 $_ngcc_current_state = 6;
336 }
337 else {
338 unexpectedLeaveAttribute($__qname);
339 }
340 }
341 break;
342 case 11:
343 {
344 if(($__uri.equals("") && $__local.equals("name"))) {
345 $_ngcc_current_state = 7;
346 }
347 else {
348 unexpectedLeaveAttribute($__qname);
349 }
350 }
351 break;
352 case 4:
353 {
354 $_ngcc_current_state = 3;
355 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
356 }
357 break;
358 default:
359 {
360 unexpectedLeaveAttribute($__qname);
361 }
362 break;
363 }
364 }
366 public void text(String $value) throws SAXException {
367 int $ai;
368 switch($_ngcc_current_state) {
369 case 13:
370 {
371 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
372 $runtime.consumeAttribute($ai);
373 $runtime.sendText(super._cookie, $value);
374 }
375 }
376 break;
377 case 0:
378 {
379 revertToParentFromText(result, super._cookie, $value);
380 }
381 break;
382 case 7:
383 {
384 if(($ai = $runtime.getAttributeIndex("","id"))>=0) {
385 $runtime.consumeAttribute($ai);
386 $runtime.sendText(super._cookie, $value);
387 }
388 else {
389 $_ngcc_current_state = 6;
390 $runtime.sendText(super._cookie, $value);
391 }
392 }
393 break;
394 case 12:
395 {
396 name = WhiteSpaceProcessor.collapse($value);
397 $_ngcc_current_state = 11;
398 }
399 break;
400 case 9:
401 {
402 $_ngcc_current_state = 8;
403 }
404 break;
405 case 3:
406 {
407 action0();
408 $_ngcc_current_state = 2;
409 $runtime.sendText(super._cookie, $value);
410 }
411 break;
412 case 4:
413 {
414 $_ngcc_current_state = 3;
415 $runtime.sendText(super._cookie, $value);
416 }
417 break;
418 }
419 }
421 public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
422 switch($__cookie__) {
423 case 241:
424 {
425 $_ngcc_current_state = 1;
426 }
427 break;
428 case 246:
429 {
430 fa = ((ForeignAttributesImpl)$__result__);
431 $_ngcc_current_state = 4;
432 }
433 break;
434 case 244:
435 {
436 annotation = ((AnnotationImpl)$__result__);
437 $_ngcc_current_state = 3;
438 }
439 break;
440 }
441 }
443 public boolean accepted() {
444 return(($_ngcc_current_state == 0));
445 }
448 private AttGroupDeclImpl result;
449 private Locator locator;
451 }