summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2011-11-07 17:56:31 +0200
committerHenri Sara <hesara@vaadin.com>2011-11-07 17:56:31 +0200
commitb2f5e652227dd4468622b092a8197afa8ee9b65f (patch)
tree5a3effd059373f2d7878c4f7d2b205f989740538
parentc93efdf86d84ae42e67f344ad5fdd13e197f952a (diff)
downloadvaadin-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().
-rw-r--r--src/com/vaadin/data/util/AbstractProperty.java4
-rw-r--r--src/com/vaadin/data/util/IndexedContainer.java3
-rw-r--r--src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java3
-rw-r--r--src/com/vaadin/ui/AbstractField.java4
-rw-r--r--src/com/vaadin/ui/Label.java3
-rw-r--r--src/com/vaadin/ui/ProgressIndicator.java7
6 files changed, 14 insertions, 10 deletions
diff --git a/src/com/vaadin/data/util/AbstractProperty.java b/src/com/vaadin/data/util/AbstractProperty.java
index 0b943e5eae..2297f13734 100644
--- a/src/com/vaadin/data/util/AbstractProperty.java
+++ b/src/com/vaadin/data/util/AbstractProperty.java
@@ -66,7 +66,9 @@ public abstract class AbstractProperty implements Property,
@Deprecated
@Override
public String toString() {
- return getStringValue();
+ throw new UnsupportedOperationException(
+ "Use Property.getValue() instead of " + getClass()
+ + ".toString()");
}
/**
diff --git a/src/com/vaadin/data/util/IndexedContainer.java b/src/com/vaadin/data/util/IndexedContainer.java
index 67bb4f0dde..c9499d4aa8 100644
--- a/src/com/vaadin/data/util/IndexedContainer.java
+++ b/src/com/vaadin/data/util/IndexedContainer.java
@@ -917,7 +917,8 @@ public class IndexedContainer extends
@Deprecated
@Override
public String toString() {
- return getStringValue();
+ throw new UnsupportedOperationException(
+ "Use Property.getValue() instead of IndexedContainerProperty.toString()");
}
/**
diff --git a/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java b/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java
index 32cc9d09d4..c1474fc760 100644
--- a/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java
+++ b/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java
@@ -178,7 +178,8 @@ final public class ColumnProperty implements Property {
@Deprecated
@Override
public String toString() {
- return getStringValue();
+ throw new UnsupportedOperationException(
+ "Use ColumnProperty.getValue() instead of ColumnProperty.toString()");
}
/**
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()");
}
/**