From 6719076bfb58ae8b8083512a91f697238680abe1 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Wed, 16 Nov 2011 09:32:28 +0000 Subject: PropertyFormatter's format now don't get called with weird Boolean value when ds is null. Fixes #4426 and #6843 svn changeset:22015/svn branch:6.7 --- src/com/vaadin/data/util/PropertyFormatter.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/data/util/PropertyFormatter.java b/src/com/vaadin/data/util/PropertyFormatter.java index c43a4771dc..3afb1cede8 100644 --- a/src/com/vaadin/data/util/PropertyFormatter.java +++ b/src/com/vaadin/data/util/PropertyFormatter.java @@ -146,14 +146,14 @@ public abstract class PropertyFormatter extends AbstractProperty implements */ @Override public String toString() { - Object value = dataSource == null ? false : dataSource.getValue(); - if (value == null) { + if (dataSource == null || dataSource.getValue() == null) { return null; } - return format(value); + return format(dataSource.getValue()); } /** Reflects the read-only status of the datasource. */ + @Override public boolean isReadOnly() { return dataSource == null ? false : dataSource.isReadOnly(); } @@ -190,6 +190,7 @@ public abstract class PropertyFormatter extends AbstractProperty implements * @param newStatus * the new read-only status of the Property. */ + @Override public void setReadOnly(boolean newStatus) { if (dataSource != null) { dataSource.setReadOnly(newStatus); @@ -208,16 +209,14 @@ public abstract class PropertyFormatter extends AbstractProperty implements } } else { try { - dataSource.setValue(parse((String) newValue)); + dataSource.setValue(parse(newValue.toString())); if (!newValue.equals(toString())) { fireValueChange(); } + } catch (ConversionException e) { + throw e; } catch (Exception e) { - if (e instanceof ConversionException) { - throw (ConversionException) e; - } else { - throw new ConversionException(e); - } + throw new ConversionException(e); } } } -- cgit v1.2.3