summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2017-01-13 10:41:27 +0900
committerMatthias Sohn <matthias.sohn@sap.com>2017-01-14 00:05:56 +0100
commit590141163fd312bedd8594cf87f82812986d09b6 (patch)
tree85b47a9bc9220d6a152c91cbfa30279a19ac3a74
parent7245aa031621c4c8d3fd9892ecbc9ded6f0e7283 (diff)
downloadjgit-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>
-rw-r--r--org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java11
-rw-r--r--org.eclipse.jgit.lfs/resources/org/eclipse/jgit/lfs/internal/LfsText.properties1
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsText.java1
4 files changed, 14 insertions, 2 deletions
diff --git a/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF b/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF
index 554b223a17..08cc189351 100644
--- a/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF
@@ -33,4 +33,5 @@ Import-Package: com.google.gson;version="[2.2.4,3.0.0)",
org.eclipse.jgit.nls;version="[4.7.0,4.8.0)",
org.eclipse.jgit.transport.http;version="[4.7.0,4.8.0)",
org.eclipse.jgit.transport.http.apache;version="[4.7.0,4.8.0)",
- org.eclipse.jgit.util;version="[4.7.0,4.8.0)"
+ org.eclipse.jgit.util;version="[4.7.0,4.8.0)",
+ org.slf4j;version="[1.7.0,2.0.0)"
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
diff --git a/org.eclipse.jgit.lfs/resources/org/eclipse/jgit/lfs/internal/LfsText.properties b/org.eclipse.jgit.lfs/resources/org/eclipse/jgit/lfs/internal/LfsText.properties
index aa089da113..e08e28cc55 100644
--- a/org.eclipse.jgit.lfs/resources/org/eclipse/jgit/lfs/internal/LfsText.properties
+++ b/org.eclipse.jgit.lfs/resources/org/eclipse/jgit/lfs/internal/LfsText.properties
@@ -8,3 +8,4 @@ repositoryNotFound=Repository {0} not found
repositoryReadOnly=Repository {0} is read-only
lfsUnavailable=LFS is not available for repository {0}
lfsUnathorized=Not authorized to perform operation {0} on repository {1}
+lfsFailedToGetRepository=failed to get repository {0}
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsText.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsText.java
index 4260fcd0cd..44595887c4 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsText.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsText.java
@@ -68,4 +68,5 @@ public class LfsText extends TranslationBundle {
/***/ public String repositoryReadOnly;
/***/ public String lfsUnavailable;
/***/ public String lfsUnathorized;
+ /***/ public String lfsFailedToGetRepository;
}