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

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


Author: mojays
Date: 2010-10-14 23:22:28 +0200 (Thu, 14 Oct 2010)
New Revision: 1128

Modified:
   trunk/src/schmitzm/geotools/feature/AttributeModificationRule.java
Log:
BugFix: In AttributeModificationRule.applyToFeature(.) the destination attribute name was not used correctly

Modified: trunk/src/schmitzm/geotools/feature/AttributeModificationRule.java
===================================================================
--- trunk/src/schmitzm/geotools/feature/AttributeModificationRule.java	2010-10-14 21:10:15 UTC (rev 1127)
+++ trunk/src/schmitzm/geotools/feature/AttributeModificationRule.java	2010-10-14 21:22:28 UTC (rev 1128)
@@ -227,13 +227,18 @@
       throw new UnsupportedOperationException("Can not apply rules from NULL feature.");
 
     // determine source value
+    String sAttrName = sourceFeature.getFeatureType().getDescriptor(getAttrIdx()).getLocalName();
     Object sValue = sourceFeature.getAttribute( getAttrIdx() );
     // determine destination value according to NULL values and
     // NULL alias
     Object dValue = getNullValueAlias();
     if ( !isNullValue(sValue))
       dValue = FeatureUtil.transformAttributeValue(sValue, getNewAttrClass());
-    destFeature.setAttribute(getNewAttrName(), dValue);
+    // set the destination value
+    String newAttrName = getNewAttrName();
+    if (newAttrName == null)
+      newAttrName = sAttrName;
+    destFeature.setAttribute(newAttrName, dValue);
   }
 
 



More information about the Schmitzm-commits mailing list