diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2017-01-13 10:41:27 +0900 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2017-01-14 00:05:56 +0100 |
commit | 590141163fd312bedd8594cf87f82812986d09b6 (patch) | |
tree | 85b47a9bc9220d6a152c91cbfa30279a19ac3a74 /org.eclipse.jgit.lfs.server/src/org/eclipse/jgit | |
parent | 7245aa031621c4c8d3fd9892ecbc9ded6f0e7283 (diff) | |
download | jgit-590141163fd312bedd8594cf87f82812986d09b6.tar.gz jgit-590141163fd312bedd8594cf87f82812986d09b6.zip |
LfsProtocolServlet: Improve error on getLargeFileRepository failure
Externalize the error message and make it more specific. Also emit
an error log.
Change-Id: Ie7b1c90c54673bfb8e133fb0aa19a117d4ca6587
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.lfs.server/src/org/eclipse/jgit')
-rw-r--r-- | org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java index 0dffb8df0b..b741693fd6 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java @@ -59,6 +59,7 @@ import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.Reader; import java.io.Writer; +import java.text.MessageFormat; import java.util.List; import javax.servlet.ServletException; @@ -75,6 +76,9 @@ import org.eclipse.jgit.lfs.errors.LfsRepositoryReadOnly; import org.eclipse.jgit.lfs.errors.LfsUnauthorized; import org.eclipse.jgit.lfs.errors.LfsUnavailable; import org.eclipse.jgit.lfs.errors.LfsValidationError; +import org.eclipse.jgit.lfs.internal.LfsText; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.gson.FieldNamingPolicy; import com.google.gson.Gson; @@ -88,6 +92,8 @@ import com.google.gson.GsonBuilder; * @since 4.3 */ public abstract class LfsProtocolServlet extends HttpServlet { + private static Logger LOG = LoggerFactory + .getLogger(LfsProtocolServlet.class); private static final long serialVersionUID = 1L; @@ -183,7 +189,10 @@ public abstract class LfsProtocolServlet extends HttpServlet { try { repo = getLargeFileRepository(request, path); if (repo == null) { - throw new LfsException("unexpected error"); //$NON-NLS-1$ + String error = MessageFormat + .format(LfsText.get().lfsFailedToGetRepository, path); + LOG.error(error); + throw new LfsException(error); } res.setStatus(SC_OK); TransferHandler handler = TransferHandler |