summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/servlet/RawServlet.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-07-05 10:32:39 -0600
committerJames Moger <james.moger@gitblit.com>2014-07-05 10:32:39 -0600
commitaa4f732bc3e285dc1433af358c89ab54c90f0d50 (patch)
tree45ee00f91e16d1849c22b6b846432f29539fa869 /src/main/java/com/gitblit/servlet/RawServlet.java
parent5b226ae3c9ff2c1b402549be2767e3580bb4736c (diff)
parent498cdca0cc3a7545311877a0fb43586ef113a801 (diff)
downloadgitblit-aa4f732bc3e285dc1433af358c89ab54c90f0d50.tar.gz
gitblit-aa4f732bc3e285dc1433af358c89ab54c90f0d50.zip
Merged #137 "NPE in RawServlet#L265"
Diffstat (limited to 'src/main/java/com/gitblit/servlet/RawServlet.java')
-rw-r--r--src/main/java/com/gitblit/servlet/RawServlet.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/servlet/RawServlet.java b/src/main/java/com/gitblit/servlet/RawServlet.java
index 0def062a..0cda59ab 100644
--- a/src/main/java/com/gitblit/servlet/RawServlet.java
+++ b/src/main/java/com/gitblit/servlet/RawServlet.java
@@ -257,6 +257,15 @@ public class RawServlet extends DaggerServlet {
// load, interpret, and serve text content as UTF-8
String [] encodings = runtimeManager.getSettings().getStrings(Keys.web.blobEncodings).toArray(new String[0]);
String content = JGitUtils.getStringContent(r, commit.getTree(), requestedPath, encodings);
+ if (content == null) {
+ logger.error("RawServlet Failed to load {} {} {}", repository, commit.getName(), path);
+ String str = MessageFormat.format(
+ "# Error\nSorry, the requested resource **{0}** was not found.",
+ requestedPath);
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ error(response, str);
+ return;
+ }
byte [] bytes = content.getBytes(Constants.ENCODING);
response.setContentLength(bytes.length);