diff options
author | James Moger <james.moger@gitblit.com> | 2013-06-11 15:50:13 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-06-11 15:50:13 -0400 |
commit | 9788200234dfe222989823c6160d2be40fd84415 (patch) | |
tree | 6dea94207431ad05a064cfd3196d3bf5dde43b62 /src/main/java/com/gitblit/git | |
parent | cedf138f3c9afeae7bcbda5dbb0511ebec297d10 (diff) | |
download | gitblit-9788200234dfe222989823c6160d2be40fd84415.tar.gz gitblit-9788200234dfe222989823c6160d2be40fd84415.zip |
Improve NPE handling for hook script enumeration (issue-253)
Diffstat (limited to 'src/main/java/com/gitblit/git')
-rw-r--r-- | src/main/java/com/gitblit/git/ReceiveHook.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/com/gitblit/git/ReceiveHook.java b/src/main/java/com/gitblit/git/ReceiveHook.java index a961f5a6..3e00b381 100644 --- a/src/main/java/com/gitblit/git/ReceiveHook.java +++ b/src/main/java/com/gitblit/git/ReceiveHook.java @@ -42,6 +42,7 @@ import com.gitblit.Keys; import com.gitblit.client.Translation;
import com.gitblit.models.RepositoryModel;
import com.gitblit.models.UserModel;
+import com.gitblit.utils.ArrayUtils;
import com.gitblit.utils.ClientLogger;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.PushLogUtils;
@@ -170,7 +171,9 @@ public class ReceiveHook implements PreReceiveHook, PostReceiveHook { Set<String> scripts = new LinkedHashSet<String>();
scripts.addAll(GitBlit.self().getPreReceiveScriptsInherited(repository));
- scripts.addAll(repository.preReceiveScripts);
+ if (!ArrayUtils.isEmpty(repository.preReceiveScripts)) {
+ scripts.addAll(repository.preReceiveScripts);
+ }
runGroovy(repository, user, commands, rp, scripts);
for (ReceiveCommand cmd : commands) {
if (!Result.NOT_ATTEMPTED.equals(cmd.getResult())) {
@@ -262,7 +265,9 @@ public class ReceiveHook implements PreReceiveHook, PostReceiveHook { // run Groovy hook scripts
Set<String> scripts = new LinkedHashSet<String>();
scripts.addAll(GitBlit.self().getPostReceiveScriptsInherited(repository));
- scripts.addAll(repository.postReceiveScripts);
+ if (!ArrayUtils.isEmpty(repository.postReceiveScripts)) {
+ scripts.addAll(repository.postReceiveScripts);
+ }
runGroovy(repository, user, commands, rp, scripts);
}
|