src/share/jaxws_classes/com/sun/xml/internal/xsom/impl/parser/state/identityConstraint.java

Mon, 02 Oct 2017 14:20:23 +0100

author
aefimov
date
Mon, 02 Oct 2017 14:20:23 +0100
changeset 1518
d9877e4e1f2b
parent 1445
06086cb6c349
child 1546
dc8316632248
permissions
-rw-r--r--

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;
    29 import com.sun.xml.internal.bind.WhiteSpaceProcessor;
    30 import com.sun.xml.internal.xsom.*;
    31 import com.sun.xml.internal.xsom.impl.*;
    32 import com.sun.xml.internal.xsom.impl.parser.*;
    33 import com.sun.xml.internal.xsom.parser.*;
    35 import java.util.ArrayList;
    36 import java.util.List;
    38 import org.xml.sax.Attributes;
    39 import org.xml.sax.SAXException;
    41 class identityConstraint extends NGCCHandler {
    42     private String name;
    43     private UName ref;
    44     private ForeignAttributesImpl fa;
    45     private AnnotationImpl ann;
    46     private XPathImpl field;
    47     protected final NGCCRuntimeEx $runtime;
    48     private int $_ngcc_current_state;
    49     protected String $uri;
    50     protected String $localName;
    51     protected String $qname;
    53     public final NGCCRuntime getRuntime() {
    54         return($runtime);
    55     }
    57     public identityConstraint(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
    58         super(source, parent, cookie);
    59         $runtime = runtime;
    60         $_ngcc_current_state = 18;
    61     }
    63     public identityConstraint(NGCCRuntimeEx runtime) {
    64         this(null, runtime, runtime, -1);
    65     }
    67     private void action0()throws SAXException {
    68         fields.add(field);
    69 }
    71     private void action1()throws SAXException {
    73             refer = new DelayedRef.IdentityConstraint(
    74               $runtime, $runtime.copyLocator(), $runtime.currentSchema, ref );
    76 }
    78     private void action2()throws SAXException {
    79         if($localName.equals("key"))
    80         category = XSIdentityConstraint.KEY;
    81       else
    82       if($localName.equals("keyref"))
    83         category = XSIdentityConstraint.KEYREF;
    84       else
    85       if($localName.equals("unique"))
    86         category = XSIdentityConstraint.UNIQUE;
    87 }
    89     public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
    90         int $ai;
    91         $uri = $__uri;
    92         $localName = $__local;
    93         $qname = $__qname;
    94         switch($_ngcc_current_state) {
    95         case 16:
    96             {
    97                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
    98                     $runtime.consumeAttribute($ai);
    99                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
   100                 }
   101                 else {
   102                     unexpectedEnterElement($__qname);
   103                 }
   104             }
   105             break;
   106         case 1:
   107             {
   108                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("field"))) {
   109                     $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
   110                     $_ngcc_current_state = 3;
   111                 }
   112                 else {
   113                     unexpectedEnterElement($__qname);
   114                 }
   115             }
   116             break;
   117         case 0:
   118             {
   119                 revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs);
   120             }
   121             break;
   122         case 17:
   123             {
   124                 if((($ai = $runtime.getAttributeIndex("","name"))>=0 && (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("selector")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))))) {
   125                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 287, null);
   126                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   127                 }
   128                 else {
   129                     unexpectedEnterElement($__qname);
   130                 }
   131             }
   132             break;
   133         case 7:
   134             {
   135                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("selector"))) {
   136                     $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
   137                     $_ngcc_current_state = 6;
   138                 }
   139                 else {
   140                     unexpectedEnterElement($__qname);
   141                 }
   142             }
   143             break;
   144         case 18:
   145             {
   146                 if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("key")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("keyref"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("unique")))) {
   147                     $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
   148                     action2();
   149                     $_ngcc_current_state = 17;
   150                 }
   151                 else {
   152                     unexpectedEnterElement($__qname);
   153                 }
   154             }
   155             break;
   156         case 3:
   157             {
   158                 if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) {
   159                     NGCCHandler h = new xpath(this, super._source, $runtime, 270);
   160                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   161                 }
   162                 else {
   163                     unexpectedEnterElement($__qname);
   164                 }
   165             }
   166             break;
   167         case 4:
   168             {
   169                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("field"))) {
   170                     $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
   171                     $_ngcc_current_state = 3;
   172                 }
   173                 else {
   174                     unexpectedEnterElement($__qname);
   175                 }
   176             }
   177             break;
   178         case 8:
   179             {
   180                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
   181                     NGCCHandler h = new annotation(this, super._source, $runtime, 277, null,AnnotationContext.IDENTITY_CONSTRAINT);
   182                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   183                 }
   184                 else {
   185                     $_ngcc_current_state = 7;
   186                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
   187                 }
   188             }
   189             break;
   190         case 10:
   191             {
   192                 if(($ai = $runtime.getAttributeIndex("","refer"))>=0) {
   193                     $runtime.consumeAttribute($ai);
   194                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
   195                 }
   196                 else {
   197                     $_ngcc_current_state = 8;
   198                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
   199                 }
   200             }
   201             break;
   202         case 6:
   203             {
   204                 if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) {
   205                     NGCCHandler h = new xpath(this, super._source, $runtime, 274);
   206                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   207                 }
   208                 else {
   209                     unexpectedEnterElement($__qname);
   210                 }
   211             }
   212             break;
   213         default:
   214             {
   215                 unexpectedEnterElement($__qname);
   216             }
   217             break;
   218         }
   219     }
   221     public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
   222         int $ai;
   223         $uri = $__uri;
   224         $localName = $__local;
   225         $qname = $__qname;
   226         switch($_ngcc_current_state) {
   227         case 5:
   228             {
   229                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("selector"))) {
   230                     $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
   231                     $_ngcc_current_state = 4;
   232                 }
   233                 else {
   234                     unexpectedLeaveElement($__qname);
   235                 }
   236             }
   237             break;
   238         case 16:
   239             {
   240                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
   241                     $runtime.consumeAttribute($ai);
   242                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   243                 }
   244                 else {
   245                     unexpectedLeaveElement($__qname);
   246                 }
   247             }
   248             break;
   249         case 1:
   250             {
   251                 if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("key")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("keyref"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("unique")))) {
   252                     $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
   253                     $_ngcc_current_state = 0;
   254                 }
   255                 else {
   256                     unexpectedLeaveElement($__qname);
   257                 }
   258             }
   259             break;
   260         case 2:
   261             {
   262                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("field"))) {
   263                     $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
   264                     $_ngcc_current_state = 1;
   265                 }
   266                 else {
   267                     unexpectedLeaveElement($__qname);
   268                 }
   269             }
   270             break;
   271         case 0:
   272             {
   273                 revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname);
   274             }
   275             break;
   276         case 17:
   277             {
   278                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
   279                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 287, null);
   280                     spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
   281                 }
   282                 else {
   283                     unexpectedLeaveElement($__qname);
   284                 }
   285             }
   286             break;
   287         case 3:
   288             {
   289                 if((($ai = $runtime.getAttributeIndex("","xpath"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("field")))) {
   290                     NGCCHandler h = new xpath(this, super._source, $runtime, 270);
   291                     spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
   292                 }
   293                 else {
   294                     unexpectedLeaveElement($__qname);
   295                 }
   296             }
   297             break;
   298         case 8:
   299             {
   300                 $_ngcc_current_state = 7;
   301                 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   302             }
   303             break;
   304         case 10:
   305             {
   306                 if(($ai = $runtime.getAttributeIndex("","refer"))>=0) {
   307                     $runtime.consumeAttribute($ai);
   308                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   309                 }
   310                 else {
   311                     $_ngcc_current_state = 8;
   312                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   313                 }
   314             }
   315             break;
   316         case 6:
   317             {
   318                 if((($ai = $runtime.getAttributeIndex("","xpath"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("selector")))) {
   319                     NGCCHandler h = new xpath(this, super._source, $runtime, 274);
   320                     spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
   321                 }
   322                 else {
   323                     unexpectedLeaveElement($__qname);
   324                 }
   325             }
   326             break;
   327         default:
   328             {
   329                 unexpectedLeaveElement($__qname);
   330             }
   331             break;
   332         }
   333     }
   335     public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
   336         int $ai;
   337         $uri = $__uri;
   338         $localName = $__local;
   339         $qname = $__qname;
   340         switch($_ngcc_current_state) {
   341         case 16:
   342             {
   343                 if(($__uri.equals("") && $__local.equals("name"))) {
   344                     $_ngcc_current_state = 15;
   345                 }
   346                 else {
   347                     unexpectedEnterAttribute($__qname);
   348                 }
   349             }
   350             break;
   351         case 0:
   352             {
   353                 revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
   354             }
   355             break;
   356         case 17:
   357             {
   358                 if(($__uri.equals("") && $__local.equals("name"))) {
   359                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 287, null);
   360                     spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
   361                 }
   362                 else {
   363                     unexpectedEnterAttribute($__qname);
   364                 }
   365             }
   366             break;
   367         case 3:
   368             {
   369                 if(($__uri.equals("") && $__local.equals("xpath"))) {
   370                     NGCCHandler h = new xpath(this, super._source, $runtime, 270);
   371                     spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
   372                 }
   373                 else {
   374                     unexpectedEnterAttribute($__qname);
   375                 }
   376             }
   377             break;
   378         case 8:
   379             {
   380                 $_ngcc_current_state = 7;
   381                 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
   382             }
   383             break;
   384         case 10:
   385             {
   386                 if(($__uri.equals("") && $__local.equals("refer"))) {
   387                     $_ngcc_current_state = 12;
   388                 }
   389                 else {
   390                     $_ngcc_current_state = 8;
   391                     $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
   392                 }
   393             }
   394             break;
   395         case 6:
   396             {
   397                 if(($__uri.equals("") && $__local.equals("xpath"))) {
   398                     NGCCHandler h = new xpath(this, super._source, $runtime, 274);
   399                     spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
   400                 }
   401                 else {
   402                     unexpectedEnterAttribute($__qname);
   403                 }
   404             }
   405             break;
   406         default:
   407             {
   408                 unexpectedEnterAttribute($__qname);
   409             }
   410             break;
   411         }
   412     }
   414     public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
   415         int $ai;
   416         $uri = $__uri;
   417         $localName = $__local;
   418         $qname = $__qname;
   419         switch($_ngcc_current_state) {
   420         case 0:
   421             {
   422                 revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
   423             }
   424             break;
   425         case 14:
   426             {
   427                 if(($__uri.equals("") && $__local.equals("name"))) {
   428                     $_ngcc_current_state = 10;
   429                 }
   430                 else {
   431                     unexpectedLeaveAttribute($__qname);
   432                 }
   433             }
   434             break;
   435         case 8:
   436             {
   437                 $_ngcc_current_state = 7;
   438                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
   439             }
   440             break;
   441         case 10:
   442             {
   443                 $_ngcc_current_state = 8;
   444                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
   445             }
   446             break;
   447         case 11:
   448             {
   449                 if(($__uri.equals("") && $__local.equals("refer"))) {
   450                     $_ngcc_current_state = 8;
   451                 }
   452                 else {
   453                     unexpectedLeaveAttribute($__qname);
   454                 }
   455             }
   456             break;
   457         default:
   458             {
   459                 unexpectedLeaveAttribute($__qname);
   460             }
   461             break;
   462         }
   463     }
   465     public void text(String $value) throws SAXException {
   466         int $ai;
   467         switch($_ngcc_current_state) {
   468         case 15:
   469             {
   470                 name = WhiteSpaceProcessor.collapse($value);
   471                 $_ngcc_current_state = 14;
   472             }
   473             break;
   474         case 16:
   475             {
   476                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
   477                     $runtime.consumeAttribute($ai);
   478                     $runtime.sendText(super._cookie, $value);
   479                 }
   480             }
   481             break;
   482         case 0:
   483             {
   484                 revertToParentFromText(makeResult(), super._cookie, $value);
   485             }
   486             break;
   487         case 12:
   488             {
   489                 NGCCHandler h = new qname(this, super._source, $runtime, 280);
   490                 spawnChildFromText(h, $value);
   491             }
   492             break;
   493         case 17:
   494             {
   495                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
   496                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 287, null);
   497                     spawnChildFromText(h, $value);
   498                 }
   499             }
   500             break;
   501         case 3:
   502             {
   503                 if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) {
   504                     NGCCHandler h = new xpath(this, super._source, $runtime, 270);
   505                     spawnChildFromText(h, $value);
   506                 }
   507             }
   508             break;
   509         case 8:
   510             {
   511                 $_ngcc_current_state = 7;
   512                 $runtime.sendText(super._cookie, $value);
   513             }
   514             break;
   515         case 10:
   516             {
   517                 if(($ai = $runtime.getAttributeIndex("","refer"))>=0) {
   518                     $runtime.consumeAttribute($ai);
   519                     $runtime.sendText(super._cookie, $value);
   520                 }
   521                 else {
   522                     $_ngcc_current_state = 8;
   523                     $runtime.sendText(super._cookie, $value);
   524                 }
   525             }
   526             break;
   527         case 6:
   528             {
   529                 if(($ai = $runtime.getAttributeIndex("","xpath"))>=0) {
   530                     NGCCHandler h = new xpath(this, super._source, $runtime, 274);
   531                     spawnChildFromText(h, $value);
   532                 }
   533             }
   534             break;
   535         }
   536     }
   538     public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
   539         switch($__cookie__) {
   540         case 270:
   541             {
   542                 field = ((XPathImpl)$__result__);
   543                 action0();
   544                 $_ngcc_current_state = 2;
   545             }
   546             break;
   547         case 287:
   548             {
   549                 fa = ((ForeignAttributesImpl)$__result__);
   550                 $_ngcc_current_state = 16;
   551             }
   552             break;
   553         case 280:
   554             {
   555                 ref = ((UName)$__result__);
   556                 action1();
   557                 $_ngcc_current_state = 11;
   558             }
   559             break;
   560         case 277:
   561             {
   562                 ann = ((AnnotationImpl)$__result__);
   563                 $_ngcc_current_state = 7;
   564             }
   565             break;
   566         case 274:
   567             {
   568                 selector = ((XPathImpl)$__result__);
   569                 $_ngcc_current_state = 5;
   570             }
   571             break;
   572         }
   573     }
   575     public boolean accepted() {
   576         return(($_ngcc_current_state == 0));
   577     }
   580       private short category;
   581       private List fields = new ArrayList();
   582       private XPathImpl selector;
   583       private DelayedRef.IdentityConstraint refer = null;
   585       private IdentityConstraintImpl makeResult() {
   586         return new IdentityConstraintImpl($runtime.document,ann,$runtime.copyLocator(),fa,
   587           category,name,selector,fields,refer);
   588       }
   590 }

mercurial