diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2011-11-16 09:32:28 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2011-11-16 09:32:28 +0000 |
commit | 6719076bfb58ae8b8083512a91f697238680abe1 (patch) | |
tree | 8e14d076190df94212305b9dc07ae01e402fd4bd /src | |
parent | 559001907bffce9b3d592920dd0d5434ecd9de8f (diff) | |
download | vaadin-framework-6719076bfb58ae8b8083512a91f697238680abe1.tar.gz vaadin-framework-6719076bfb58ae8b8083512a91f697238680abe1.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/data/util/PropertyFormatter.java | 17 |
1 files changed, 8 insertions, 9 deletions
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); } } } |