/** * 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), * then this method is called during the printing of the final stack trace, and hence the correct error message gets * displayed. * @see #getShortMessage() */ public String getMessage() { if (!specialConstructor) { return super.getMessage(); } int maxSize = getExpectedTokenSequencesMaxSize(); StringBuffer expected = buildExpectedTokenMessage(); StringBuffer retval = buildShortMessage(maxSize); if (expectedTokenSequences.length == 1) { retval.append(Messages.ParseException_expecting).append(eol).append(" "); } else { retval.append(Messages.ParseException_expection_oneof).append(eol).append(" "); } retval.append(expected); return retval.toString(); }