changeset 733:18dc6a99f4f4

Fixed NPE will using StateBase without a given Query. gnv-artifacts/trunk@771 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 15 Mar 2010 12:34:40 +0000
parents 1a0ed4c521bd
children 8f7fe0cc6e5a
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java
diffstat 2 files changed, 35 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Mon Mar 15 12:30:53 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Mon Mar 15 12:34:40 2010 +0000
@@ -1,3 +1,10 @@
+2010-03-15  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java (feed):
+	  Bugfix: We have States which don't have tor Query Data from a Database 
+	  for its Description. So now the Description will only be determined if a
+	  Query was configured to this State.
+
 2010-03-15  Tim Englich  <tim.englich@intevation.de>
 
 	* src/main/java/de/intevation/gnv/state/PreSettingsTransferState.java (setup):
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java	Mon Mar 15 12:30:53 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java	Mon Mar 15 12:34:40 2010 +0000
@@ -1,37 +1,5 @@
 package de.intevation.gnv.state;
 
-import de.intevation.artifactdatabase.Config;
-import de.intevation.artifactdatabase.XMLUtils;
-
-import de.intevation.artifacts.ArtifactNamespaceContext;
-import de.intevation.artifacts.CallContext;
-import de.intevation.artifacts.CallMeta;
-
-import de.intevation.gnv.artifacts.cache.CacheFactory;
-
-import de.intevation.gnv.artifacts.ressource.RessourceFactory;
-
-import de.intevation.gnv.geobackend.base.Result;
-
-import de.intevation.gnv.geobackend.base.query.QueryExecutor;
-import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
-
-import de.intevation.gnv.geobackend.base.query.exception.QueryException;
-
-import de.intevation.gnv.geobackend.util.DateUtils;
-
-import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
-import de.intevation.gnv.state.describedata.KeyValueDescibeData;
-import de.intevation.gnv.state.describedata.MinMaxDescribeData;
-import de.intevation.gnv.state.describedata.NamedArrayList;
-import de.intevation.gnv.state.describedata.NamedCollection;
-import de.intevation.gnv.state.describedata.SingleValueDescribeData;
-
-import de.intevation.gnv.state.exception.StateException;
-
-import de.intevation.gnv.utils.ArtifactXMLUtilities;
-import de.intevation.gnv.utils.InputValidator;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -48,12 +16,33 @@
 import net.sf.ehcache.Cache;
 
 import org.apache.log4j.Logger;
-
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+import de.intevation.artifactdatabase.Config;
+import de.intevation.artifactdatabase.XMLUtils;
+import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.gnv.artifacts.cache.CacheFactory;
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.query.QueryExecutor;
+import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+import de.intevation.gnv.geobackend.util.DateUtils;
+import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+import de.intevation.gnv.state.describedata.MinMaxDescribeData;
+import de.intevation.gnv.state.describedata.NamedArrayList;
+import de.intevation.gnv.state.describedata.NamedCollection;
+import de.intevation.gnv.state.describedata.SingleValueDescribeData;
+import de.intevation.gnv.state.exception.StateException;
+import de.intevation.gnv.utils.ArtifactXMLUtilities;
+import de.intevation.gnv.utils.InputValidator;
+
 /**
  * @author Tim Englich         (tim.englich@intevation.de)
  * @author Ingo Weinzierl      (ingo.weinzierl@intevation.de)
@@ -247,8 +236,12 @@
                     boolean valid = iv.isInputValid(tmpItem.getValue(),
                             inputValue.getType());
                     if (valid) {
-                        String[] desc = getDescriptionForInputData(tmpItem, uuid);
-                        tmpItem.setDescription(desc);
+                        if (this.queryID != null){
+                            // Query the Description only if it is possible to 
+                            // Query data from the Database for this State.
+                            String[] desc = getDescriptionForInputData(tmpItem, uuid);
+                            tmpItem.setDescription(desc);
+                        }
                         this.inputData.put(tmpItem.getName(), tmpItem);
                     } else {
                         String msg = resFactory.getRessource(

http://dive4elements.wald.intevation.org