From 06bab95e00891b40c4afe65f29e5969fc9df4f2a Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 19 Dec 2017 14:02:34 +0900 Subject: [PATCH] InvalidPatternException: Add constructor that takes Throwable Change-Id: Idadec0abc1c6d76f19f51a65a4b45df444c20486 Signed-off-by: David Pursehouse --- .../jgit/errors/InvalidPatternException.java | 17 +++++++++++++++++ .../eclipse/jgit/ignore/internal/Strings.java | 6 ++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidPatternException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidPatternException.java index a78a6d2ac..949c4ff88 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidPatternException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidPatternException.java @@ -66,6 +66,23 @@ public class InvalidPatternException extends Exception { this.pattern = pattern; } + /** + * Constructor for InvalidPatternException + * + * @param message + * explains what was wrong with the pattern. + * @param pattern + * the invalid pattern. + * @param cause + * the cause. + * @since 4.10 + */ + public InvalidPatternException(String message, String pattern, + Throwable cause) { + this(message, pattern); + initCause(cause); + } + /** * Get the invalid pattern * diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java index 8828931ee..4d33395d4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java @@ -442,12 +442,10 @@ public class Strings { try { return Pattern.compile(sb.toString()); } catch (PatternSyntaxException e) { - InvalidPatternException patternException = new InvalidPatternException( + throw new InvalidPatternException( MessageFormat.format(JGitText.get().invalidIgnoreRule, pattern), - pattern); - patternException.initCause(e); - throw patternException; + pattern, e); } }