summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-04-17 22:20:32 -0400
committerJames Moger <james.moger@gitblit.com>2014-04-17 23:08:07 -0400
commitdfd6f5d75aebd7a0a41305831ec6d194ae092f5d (patch)
treee62a0e205625a4a91f8c9e46bb17d6d8706082f9 /src/main/java
parent81583ac83a13e1cf321494bfb50595a961dffa59 (diff)
downloadgitblit-dfd6f5d75aebd7a0a41305831ec6d194ae092f5d.tar.gz
gitblit-dfd6f5d75aebd7a0a41305831ec6d194ae092f5d.zip
[findbugs] Fix potential NPE in DiffStat generation
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/gitblit/utils/DiffUtils.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/com/gitblit/utils/DiffUtils.java b/src/main/java/com/gitblit/utils/DiffUtils.java
index b49497e7..dd2a7807 100644
--- a/src/main/java/com/gitblit/utils/DiffUtils.java
+++ b/src/main/java/com/gitblit/utils/DiffUtils.java
@@ -363,19 +363,19 @@ public class DiffUtils {
public static DiffStat getDiffStat(Repository repository, String base, String tip) {
RevCommit baseCommit = null;
RevCommit tipCommit = null;
- RevWalk revWalk = null;
+ RevWalk revWalk = new RevWalk(repository);
try {
- revWalk = new RevWalk(repository);
tipCommit = revWalk.parseCommit(repository.resolve(tip));
if (!StringUtils.isEmpty(base)) {
baseCommit = revWalk.parseCommit(repository.resolve(base));
}
+ return getDiffStat(repository, baseCommit, tipCommit, null);
} catch (Exception e) {
LOGGER.error("failed to generate diffstat!", e);
} finally {
revWalk.dispose();
}
- return getDiffStat(repository, baseCommit, tipCommit, null);
+ return null;
}
public static DiffStat getDiffStat(Repository repository, RevCommit commit) {