From fe329f5db4328a58e2cd1c7d1cec6f2676412745 Mon Sep 17 00:00:00 2001 From: Grace Wang Date: Tue, 22 Nov 2016 21:05:39 -0500 Subject: [PATCH] Specify RevisionSyntaxException message in Repository#resolve This does not address all cases where no message is specified, only cases where Repository#isValidRefName returns false. Change-Id: Ib88cdabfdcdf37be0053e06949b0e21ad87a9575 Signed-off-by: Grace Wang --- .../src/org/eclipse/jgit/lib/Repository.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 8b6b28d7c..c5b2ef8e5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -652,7 +652,10 @@ public abstract class Repository implements AutoCloseable { // detached name = Constants.HEAD; if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$ - throw new RevisionSyntaxException(revstr); + throw new RevisionSyntaxException(MessageFormat + .format(JGitText.get().invalidRefName, + name), + revstr); Ref ref = getRef(name); name = null; if (ref == null) @@ -702,7 +705,10 @@ public abstract class Repository implements AutoCloseable { if (name.equals("")) //$NON-NLS-1$ name = Constants.HEAD; if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$ - throw new RevisionSyntaxException(revstr); + throw new RevisionSyntaxException(MessageFormat + .format(JGitText.get().invalidRefName, + name), + revstr); Ref ref = getRef(name); name = null; if (ref == null) @@ -751,7 +757,9 @@ public abstract class Repository implements AutoCloseable { return null; name = revstr.substring(done); if (!Repository.isValidRefName("x/" + name)) //$NON-NLS-1$ - throw new RevisionSyntaxException(revstr); + throw new RevisionSyntaxException( + MessageFormat.format(JGitText.get().invalidRefName, name), + revstr); if (getRef(name) != null) return name; return resolveSimple(name);