From 39ea57835c1b9eeab6f8a4cd652e8742b294ebac Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Thu, 6 May 2010 15:55:55 +0000 Subject: [PATCH] property formatter now handles nulls better in setValue() svn changeset:13075/svn branch:6.3 --- .../vaadin/data/util/PropertyFormatter.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/com/vaadin/data/util/PropertyFormatter.java b/src/com/vaadin/data/util/PropertyFormatter.java index ea612b2c2b..3d7b3355f6 100644 --- a/src/com/vaadin/data/util/PropertyFormatter.java +++ b/src/com/vaadin/data/util/PropertyFormatter.java @@ -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); + } } } - } /** -- 2.39.5