Override UnexpectedCharacterException constructor

Override the constructor to accept the unexpected character
and optionally the expected character types.
This commit is contained in:
Zafar Khaja 2014-01-31 18:34:22 +04:00
parent f95c18cf6c
commit 4ffac6d39f

View File

@ -48,8 +48,8 @@ public class UnexpectedCharacterException extends ParseException {
private final CharType[] expected;
/**
* Constructs a {@code UnexpectedCharacterException} instance
* with the unexpected character and the expected types.
* Constructs a {@code UnexpectedCharacterException} instance with
* the wrapped {@code UnexpectedElementException} exception.
*
* @param cause the wrapped exception
*/
@ -58,6 +58,17 @@ public class UnexpectedCharacterException extends ParseException {
expected = (CharType[]) cause.getExpectedElementTypes();
}
/**
* Constructs a {@code UnexpectedCharacterException} instance
* with the unexpected character and the expected types.
*
* @param cause the wrapped exception
*/
UnexpectedCharacterException(Character unexpected, CharType... expected) {
this.unexpected = unexpected;
this.expected = expected;
}
/**
* Gets the unexpected character.
*