final String objectId = WicketUtils.getObject(params);\r
final String blobPath = WicketUtils.getPath(params);\r
\r
- final String notFound = MessageFormat.format("Raw page failed to find {0} in {1} @ {2}",\r
- blobPath, repositoryName, objectId);\r
-\r
String[] encodings = getEncodings();\r
GitBlitWebSession session = GitBlitWebSession.get();\r
UserModel user = session.getUser();\r
// objectid referenced raw view\r
byte [] binary = JGitUtils.getByteContent(r, objectId);\r
if (binary == null) {\r
- logger.error(notFound);\r
- throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, notFound);\r
+ final String objectNotFound = MessageFormat.format("Raw page failed to find object {0} in {1}",\r
+ objectId, repositoryName);\r
+ logger.error(objectNotFound);\r
+ throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, objectNotFound);\r
}\r
contentType = "application/octet-stream";\r
response.setContentType(contentType);\r
} else {\r
// standard raw blob view\r
RevCommit commit = JGitUtils.getCommit(r, objectId);\r
+ if (commit == null) {\r
+ final String commitNotFound = MessageFormat.format("Raw page failed to find commit {0} in {1}",\r
+ objectId, repositoryName);\r
+ logger.error(commitNotFound);\r
+ throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, commitNotFound);\r
+ }\r
\r
String filename = blobPath;\r
if (blobPath.indexOf('/') > -1) {\r
map.put(ext.toLowerCase(), 3);\r
}\r
\r
+ final String blobNotFound = MessageFormat.format("Raw page failed to find blob {0} in {1} @ {2}",\r
+ blobPath, repositoryName, objectId);\r
+\r
if (extension != null) {\r
int type = 0;\r
if (map.containsKey(extension)) {\r
// image blobs\r
byte[] image = JGitUtils.getByteContent(r, commit.getTree(), blobPath, true);\r
if (image == null) {\r
- logger.error(notFound);\r
- throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, notFound);\r
+ logger.error(blobNotFound);\r
+ throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, blobNotFound);\r
}\r
contentType = "image/" + extension.toLowerCase();\r
response.setContentType(contentType);\r
// binary blobs (download)\r
byte[] binary = JGitUtils.getByteContent(r, commit.getTree(), blobPath, true);\r
if (binary == null) {\r
- logger.error(notFound);\r
- throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, notFound);\r
+ logger.error(blobNotFound);\r
+ throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, blobNotFound);\r
}\r
contentType = "application/octet-stream";\r
response.setContentLength(binary.length);\r
String content = JGitUtils.getStringContent(r, commit.getTree(),\r
blobPath, encodings);\r
if (content == null) {\r
- logger.error(notFound);\r
- throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, notFound);\r
+ logger.error(blobNotFound);\r
+ throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, blobNotFound);\r
}\r
contentType = "text/plain; charset=UTF-8";\r
response.setContentType(contentType);\r
String content = JGitUtils.getStringContent(r, commit.getTree(), blobPath,\r
encodings);\r
if (content == null) {\r
- logger.error(notFound);\r
- throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, notFound);\r
+ logger.error(blobNotFound);\r
+ throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, blobNotFound);\r
}\r
contentType = "text/plain; charset=UTF-8";\r
response.setContentType(contentType);\r