]> source.dussan.org Git - vaadin-framework.git/commitdiff
property formatter now handles nulls better in setValue()
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 6 May 2010 15:55:55 +0000 (15:55 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 6 May 2010 15:55:55 +0000 (15:55 +0000)
svn changeset:13075/svn branch:6.3

src/com/vaadin/data/util/PropertyFormatter.java

index ea612b2c2b706197ae698aac794cd33fa46702b6..3d7b3355f6067e5a9fdc260a680ae6162fa4954e 100644 (file)
@@ -205,21 +205,24 @@ public abstract class PropertyFormatter implements Property,
             return;
         }
         if (newValue == null) {
-            dataSource.setValue(null);
-        }
-        try {
-            dataSource.setValue(parse((String) newValue));
-            if (!newValue.equals(toString())) {
+            if (dataSource.getValue() != null) {
+                dataSource.setValue(null);
                 fireValueChange();
             }
-        } catch (Exception e) {
-            if (e instanceof ConversionException) {
-                throw (ConversionException) e;
-            } else {
-                throw new ConversionException(e);
+        } else {
+            try {
+                dataSource.setValue(parse((String) newValue));
+                if (!newValue.equals(toString())) {
+                    fireValueChange();
+                }
+            } catch (Exception e) {
+                if (e instanceof ConversionException) {
+                    throw (ConversionException) e;
+                } else {
+                    throw new ConversionException(e);
+                }
             }
         }
-
     }
 
     /**