[Schmitzm-commits] r1123 - trunk/src/schmitzm/geotools/feature

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Oct 14 22:39:05 CEST 2010


Author: mojays
Date: 2010-10-14 22:39:04 +0200 (Thu, 14 Oct 2010)
New Revision: 1123

Modified:
   trunk/src/schmitzm/geotools/feature/AttributeModificationRule.java
   trunk/src/schmitzm/geotools/feature/FeatureUtil.java
Log:


Modified: trunk/src/schmitzm/geotools/feature/AttributeModificationRule.java
===================================================================
--- trunk/src/schmitzm/geotools/feature/AttributeModificationRule.java	2010-10-14 20:27:05 UTC (rev 1122)
+++ trunk/src/schmitzm/geotools/feature/AttributeModificationRule.java	2010-10-14 20:39:04 UTC (rev 1123)
@@ -116,6 +116,15 @@
   }
   
   /**
+   * Checks whether a value is a part of {@link #getNullValues()}. 
+   * @param value a value to test
+   * @return {@code false} if no NULL values are set
+   */
+  public boolean isNullValue(Object value) {
+    return nullValues != null && nullValues.contains(value);
+  }
+  
+  /**
    * Applies the modifications defined by this {@link AttributeModificationRule} and
    * creates a new {@link AttributeDescriptor}.
    */

Modified: trunk/src/schmitzm/geotools/feature/FeatureUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/feature/FeatureUtil.java	2010-10-14 20:27:05 UTC (rev 1122)
+++ trunk/src/schmitzm/geotools/feature/FeatureUtil.java	2010-10-14 20:39:04 UTC (rev 1123)
@@ -2499,7 +2499,9 @@
           for (int destAttrIdx=0; destAttrIdx < destAttrRule.length; destAttrIdx++) {
             AttributeModificationRule rule = destAttrRule[destAttrIdx];
             Object sValue = sFeature.getAttribute(rule.getAttrIdx());
-            Object dValue = transformAttributeValue(sValue, rule.getNewAttrClass());
+            Object dValue = null;
+            if ( !rule.isNullValue(sValue))
+             dValue = transformAttributeValue(sValue, rule.getNewAttrClass());
             dFeature.setAttribute(destAttrIdx, dValue);
           }
           // write the destination feature



More information about the Schmitzm-commits mailing list