changeset 382:4af6379ac20b

Changed exception handling if a the value of a column, which is not contained in Result, is requested. Will not throw an exception but return null. geo-backend/trunk@417 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 11 Dec 2009 10:45:18 +0000
parents 4a874c664123
children 0b813ae17173
files geo-backend/ChangeLog geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/geo-backend/ChangeLog	Fri Dec 11 10:34:36 2009 +0000
+++ b/geo-backend/ChangeLog	Fri Dec 11 10:45:18 2009 +0000
@@ -1,3 +1,10 @@
+2009-12-11  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java:
+	  DefaultResult will return null if it doesn't contain the specified column
+	  name in method getString(String columnName), instead of throwing an
+	  exception.
+
 2009-12-11	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java,
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java	Fri Dec 11 10:34:36 2009 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java	Fri Dec 11 10:45:18 2009 +0000
@@ -108,7 +108,9 @@
      * @see de.intevation.gnv.geobackend.base.Result#getString(java.lang.String)
      */
     public String getString(String columnName) {
-        return getString(resultDescriptor.getColumnIndex(columnName));
+        int idx = resultDescriptor.getColumnIndex(columnName);
+
+        return idx > -1 ? getString(idx) : null;
     }
 
     public String getString(int column) {

http://dive4elements.wald.intevation.org