From 4ffac6d39faf37e8d4edb4619f6ef8eff3963a0b Mon Sep 17 00:00:00 2001 From: Zafar Khaja Date: Fri, 31 Jan 2014 18:34:22 +0400 Subject: [PATCH] Override UnexpectedCharacterException constructor Override the constructor to accept the unexpected character and optionally the expected character types. --- .../semver/UnexpectedCharacterException.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/zafarkhaja/semver/UnexpectedCharacterException.java b/src/main/java/com/github/zafarkhaja/semver/UnexpectedCharacterException.java index 52c6c0e..485d7c6 100644 --- a/src/main/java/com/github/zafarkhaja/semver/UnexpectedCharacterException.java +++ b/src/main/java/com/github/zafarkhaja/semver/UnexpectedCharacterException.java @@ -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. *