[Dive4elements-commits] [PATCH 1 of 3] Fix: Don't fail with NPE if no hooks are found in the xml file

Wald Commits scm-commit at wald.intevation.org
Wed Dec 12 16:07:08 CET 2012


# HG changeset patch
# User Björn Ricks <bjoern.ricks at intevation.de>
# Date 1355324715 -3600
# Node ID ddfaf255bb40ae33aa64d85997efd795018ab3c1
# Parent  5803c2078f0c68a531a7edeea8cc070c9dcb3705
Fix: Don't fail with NPE if no hooks are found in the xml file

diff -r 5803c2078f0c -r ddfaf255bb40 artifact-database/src/main/java/de/intevation/artifactdatabase/FactoryBootstrap.java
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/FactoryBootstrap.java	Fri Nov 16 18:36:49 2012 +0100
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/FactoryBootstrap.java	Wed Dec 12 16:05:15 2012 +0100
@@ -550,6 +550,11 @@
 
         NodeList nodes = Config.getNodeSetXPath(HOOKS);
 
+        if (nodes == null) {
+            logger.info("No hooks found");
+            return;
+        }
+
         for (int i = 0, len = nodes.getLength(); i < len; i++) {
             Node   cfg     = nodes.item(i);
             String applies = Config.getStringXPath(cfg, "@applies");


More information about the Dive4elements-commits mailing list