--- old/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/compact/ParseException.java 2013-08-13 18:17:43.347168099 +0200
+++ new/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/compact/ParseException.java 2013-08-13 18:17:43.295165800 +0200
@@ -22,29 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-/*
- * Copyright (C) 2004-2011
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */
-/* JavaCCOptions:KEEP_LINE_COL=null */
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */
package com.sun.xml.internal.rngom.parse.compact;
/**
@@ -59,24 +37,24 @@
public class ParseException extends Exception {
/**
- * The version identifier for this Serializable class.
- * Increment only if the serialized form of the
- * class changes.
- */
- private static final long serialVersionUID = 1L;
-
- /**
* This constructor is used by the method "generateParseException"
* in the generated parser. Calling this constructor generates
* a new object of this type with the fields "currentToken",
- * "expectedTokenSequences", and "tokenImage" set.
+ * "expectedTokenSequences", and "tokenImage" set. The boolean
+ * flag "specialConstructor" is also set to true to indicate that
+ * this constructor was used to create this object.
+ * This constructor calls its super class with the empty string
+ * to force the "toString" method of parent class "Throwable" to
+ * print the error message in the form:
+ * ParseException:
*/
public ParseException(Token currentTokenVal,
int[][] expectedTokenSequencesVal,
String[] tokenImageVal
)
{
- super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
+ super("");
+ specialConstructor = true;
currentToken = currentTokenVal;
expectedTokenSequences = expectedTokenSequencesVal;
tokenImage = tokenImageVal;
@@ -94,13 +72,20 @@
public ParseException() {
super();
+ specialConstructor = false;
}
- /** Constructor with message. */
public ParseException(String message) {
super(message);
+ specialConstructor = false;
}
+ /**
+ * This variable determines which constructor was used to create
+ * this object and thereby affects the semantics of the
+ * "getMessage" method (see below).
+ */
+ protected boolean specialConstructor;
/**
* This is the last token that has been consumed successfully. If
@@ -124,29 +109,32 @@
public String[] tokenImage;
/**
- * It uses "currentToken" and "expectedTokenSequences" to generate a parse
+ * This method has the standard behavior when this object has been
+ * created using the standard constructors. Otherwise, it uses
+ * "currentToken" and "expectedTokenSequences" to generate a parse
* error message and returns it. If this object has been created
* due to a parse error, and you do not catch it (it gets thrown
- * from the parser) the correct error message
+ * from the parser), then this method is called during the printing
+ * of the final stack trace, and hence the correct error message
* gets displayed.
*/
- private static String initialise(Token currentToken,
- int[][] expectedTokenSequences,
- String[] tokenImage) {
- String eol = System.getProperty("line.separator", "\n");
- StringBuffer expected = new StringBuffer();
+ public String getMessage() {
+ if (!specialConstructor) {
+ return super.getMessage();
+ }
+ String expected = "";
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < expectedTokenSequences[i].length) {
maxSize = expectedTokenSequences[i].length;
}
for (int j = 0; j < expectedTokenSequences[i].length; j++) {
- expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
+ expected += tokenImage[expectedTokenSequences[i][j]] + " ";
}
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
- expected.append("...");
+ expected += "...";
}
- expected.append(eol).append(" ");
+ expected += eol + " ";
}
String retval = "Encountered \"";
Token tok = currentToken.next;
@@ -156,10 +144,7 @@
retval += tokenImage[0];
break;
}
- retval += " " + tokenImage[tok.kind];
- retval += " \"";
retval += add_escapes(tok.image);
- retval += " \"";
tok = tok.next;
}
retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
@@ -169,7 +154,7 @@
} else {
retval += "Was expecting one of:" + eol + " ";
}
- retval += expected.toString();
+ retval += expected;
return retval;
}
@@ -183,7 +168,7 @@
* when these raw version cannot be used as part of an ASCII
* string literal.
*/
- static String add_escapes(String str) {
+ protected String add_escapes(String str) {
StringBuffer retval = new StringBuffer();
char ch;
for (int i = 0; i < str.length(); i++) {
@@ -229,4 +214,3 @@
}
}
-/* JavaCC - OriginalChecksum=bd9c46050b4c34811443efbf89741eef (do not edit this line) */