diff options
author | Henri Sara <hesara@vaadin.com> | 2011-11-07 17:56:31 +0200 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2011-11-07 17:56:31 +0200 |
commit | b2f5e652227dd4468622b092a8197afa8ee9b65f (patch) | |
tree | 5a3effd059373f2d7878c4f7d2b205f989740538 /src/com/vaadin/ui | |
parent | c93efdf86d84ae42e67f344ad5fdd13e197f952a (diff) | |
download | vaadin-framework-b2f5e652227dd4468622b092a8197afa8ee9b65f.tar.gz vaadin-framework-b2f5e652227dd4468622b092a8197afa8ee9b65f.zip |
Throw exception from Property.toString() implementations.
The default implementations of Property.toString() now throw an
UnsupportedOperationException to help find and eliminate code relying on
Property.toString().
Diffstat (limited to 'src/com/vaadin/ui')
-rw-r--r-- | src/com/vaadin/ui/AbstractField.java | 4 | ||||
-rw-r--r-- | src/com/vaadin/ui/Label.java | 3 | ||||
-rw-r--r-- | src/com/vaadin/ui/ProgressIndicator.java | 7 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/com/vaadin/ui/AbstractField.java b/src/com/vaadin/ui/AbstractField.java index 8754d3cd53..007f851a72 100644 --- a/src/com/vaadin/ui/AbstractField.java +++ b/src/com/vaadin/ui/AbstractField.java @@ -410,7 +410,9 @@ public abstract class AbstractField extends AbstractComponent implements Field, @Deprecated @Override public String toString() { - return getStringValue(); + throw new UnsupportedOperationException( + "Use Property.getValue() instead of " + getClass() + + ".toString()"); } /** diff --git a/src/com/vaadin/ui/Label.java b/src/com/vaadin/ui/Label.java index 5a82b64243..c7504230e3 100644 --- a/src/com/vaadin/ui/Label.java +++ b/src/com/vaadin/ui/Label.java @@ -252,7 +252,8 @@ public class Label extends AbstractComponent implements Property, @Deprecated @Override public String toString() { - return getStringValue(); + throw new UnsupportedOperationException( + "Use Property.getValue() instead of Label.toString()"); } /** diff --git a/src/com/vaadin/ui/ProgressIndicator.java b/src/com/vaadin/ui/ProgressIndicator.java index 88e0edcd02..6f2758f323 100644 --- a/src/com/vaadin/ui/ProgressIndicator.java +++ b/src/com/vaadin/ui/ProgressIndicator.java @@ -155,11 +155,8 @@ public class ProgressIndicator extends AbstractField implements Property, @Deprecated @Override public String toString() { - if (dataSource == null) { - throw new IllegalStateException("Datasource must be set"); - } - Object value = dataSource.getValue(); - return (null != value) ? value.toString() : null; + throw new UnsupportedOperationException( + "Use Property.getValue() instead of ProgressIndicator.toString()"); } /** |