summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2015-11-25 08:50:10 -0500
committerJames Moger <james.moger@gitblit.com>2015-11-25 08:50:10 -0500
commitd1eb00e7e98ec4d932a632e52d336c43a4351cb4 (patch)
tree54ca81338b267d5a0d1cfd789ae1a419d5ae8882 /src/main/java/com/gitblit
parent1aec17636d8c548257cb307f8cc1e41354e00421 (diff)
downloadgitblit-d1eb00e7e98ec4d932a632e52d336c43a4351cb4.tar.gz
gitblit-d1eb00e7e98ec4d932a632e52d336c43a4351cb4.zip
Handle possible NPE when extracting WAR resources into a new directory
Diffstat (limited to 'src/main/java/com/gitblit')
-rw-r--r--src/main/java/com/gitblit/servlet/GitblitContext.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/servlet/GitblitContext.java b/src/main/java/com/gitblit/servlet/GitblitContext.java
index fb8f6b9d..750da796 100644
--- a/src/main/java/com/gitblit/servlet/GitblitContext.java
+++ b/src/main/java/com/gitblit/servlet/GitblitContext.java
@@ -24,6 +24,7 @@ import java.io.OutputStream;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import javax.naming.Context;
import javax.naming.InitialContext;
@@ -455,7 +456,12 @@ public class GitblitContext extends GuiceServletContextListener {
}
protected void extractResources(ServletContext context, String path, File toDir) {
- for (String resource : context.getResourcePaths(path)) {
+ Set<String> resources = context.getResourcePaths(path);
+ if (resources == null) {
+ logger.warn("There are no WAR resources to extract from {}", path);
+ return;
+ }
+ for (String resource : resources) {
// extract the resource to the directory if it does not exist
File f = new File(toDir, resource.substring(path.length()));
if (!f.exists()) {