< prev index next >

src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/scd/ParseException.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2012, 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


  32  * This exception is thrown when parse errors are encountered.
  33  * You can explicitly create objects of this exception type by
  34  * calling the method generateParseException in the generated
  35  * parser.
  36  *
  37  * You can modify this class to customize your error reporting
  38  * mechanisms so long as you retain the public fields.
  39  */
  40 public class ParseException extends Exception {
  41 
  42   /**
  43    * This constructor is used by the method "generateParseException"
  44    * in the generated parser.  Calling this constructor generates
  45    * a new object of this type with the fields "currentToken",
  46    * "expectedTokenSequences", and "tokenImage" set.  The boolean
  47    * flag "specialConstructor" is also set to true to indicate that
  48    * this constructor was used to create this object.
  49    * This constructor calls its super class with the empty string
  50    * to force the "toString" method of parent class "Throwable" to
  51    * print the error message in the form:
  52    *     ParseException: <result of getMessage>
  53    */
  54   public ParseException(Token currentTokenVal,
  55                         int[][] expectedTokenSequencesVal,
  56                         List<String> tokenImageVal
  57                        )
  58   {
  59     super("");
  60     specialConstructor = true;
  61     currentToken = currentTokenVal;
  62     expectedTokenSequences = expectedTokenSequencesVal;
  63     tokenImage = tokenImageVal;
  64   }
  65 
  66   /**
  67    * The following constructors are for use by you for whatever
  68    * purpose you can think of.  Constructing the exception in this
  69    * manner makes the exception behave in the normal way - i.e., as
  70    * documented in the class "Throwable".  The fields "errorToken",
  71    * "expectedTokenSequences", and "tokenImage" do not contain
  72    * relevant information.  The JavaCC generated code does not use


   1 /*
   2  * Copyright (c) 1997, 2015, 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


  32  * This exception is thrown when parse errors are encountered.
  33  * You can explicitly create objects of this exception type by
  34  * calling the method generateParseException in the generated
  35  * parser.
  36  *
  37  * You can modify this class to customize your error reporting
  38  * mechanisms so long as you retain the public fields.
  39  */
  40 public class ParseException extends Exception {
  41 
  42   /**
  43    * This constructor is used by the method "generateParseException"
  44    * in the generated parser.  Calling this constructor generates
  45    * a new object of this type with the fields "currentToken",
  46    * "expectedTokenSequences", and "tokenImage" set.  The boolean
  47    * flag "specialConstructor" is also set to true to indicate that
  48    * this constructor was used to create this object.
  49    * This constructor calls its super class with the empty string
  50    * to force the "toString" method of parent class "Throwable" to
  51    * print the error message in the form:
  52    *     ParseException: {@code <result of getMessage>}
  53    */
  54   public ParseException(Token currentTokenVal,
  55                         int[][] expectedTokenSequencesVal,
  56                         List<String> tokenImageVal
  57                        )
  58   {
  59     super("");
  60     specialConstructor = true;
  61     currentToken = currentTokenVal;
  62     expectedTokenSequences = expectedTokenSequencesVal;
  63     tokenImage = tokenImageVal;
  64   }
  65 
  66   /**
  67    * The following constructors are for use by you for whatever
  68    * purpose you can think of.  Constructing the exception in this
  69    * manner makes the exception behave in the normal way - i.e., as
  70    * documented in the class "Throwable".  The fields "errorToken",
  71    * "expectedTokenSequences", and "tokenImage" do not contain
  72    * relevant information.  The JavaCC generated code does not use


< prev index next >