summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-08-18 22:38:21 +0300
committerArtur Signell <artur@vaadin.com>2016-08-19 08:06:13 +0300
commitb565956a51e870287fb01ea9365ce947e33641f5 (patch)
tree30e339c29ef628f6a2ffe83109c3785ed26fafb0 /server
parenta836efc40cbda8cf0e8548b4b6cf4cf2a0e0026e (diff)
downloadvaadin-framework-b565956a51e870287fb01ea9365ce947e33641f5.tar.gz
vaadin-framework-b565956a51e870287fb01ea9365ce947e33641f5.zip
Remove accidental dependency from new converters to old
Change-Id: I9cd9e691fb30063a914729d15011f5d50e19d8d4
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/data/util/converter/AbstractStringToNumberConverter.java10
-rw-r--r--server/src/main/java/com/vaadin/data/util/converter/Converter.java7
-rw-r--r--server/src/main/java/com/vaadin/data/util/converter/StringToIntegerConverter.java4
3 files changed, 6 insertions, 15 deletions
diff --git a/server/src/main/java/com/vaadin/data/util/converter/AbstractStringToNumberConverter.java b/server/src/main/java/com/vaadin/data/util/converter/AbstractStringToNumberConverter.java
index 1dbc2bf46a..bd2ea690a1 100644
--- a/server/src/main/java/com/vaadin/data/util/converter/AbstractStringToNumberConverter.java
+++ b/server/src/main/java/com/vaadin/data/util/converter/AbstractStringToNumberConverter.java
@@ -20,8 +20,6 @@ import java.text.NumberFormat;
import java.text.ParsePosition;
import java.util.Locale;
-import com.vaadin.v7.data.util.converter.LegacyConverter.ConversionException;
-
/**
* A converter that converts from the number type T to {@link String} and back.
* Uses the given locale and {@link NumberFormat} for formatting and parsing.
@@ -62,11 +60,8 @@ public abstract class AbstractStringToNumberConverter<T>
* @param locale
* The locale to use for conversion
* @return The converted value
- * @throws ConversionException
- * If there was a problem converting the value
*/
- protected Number convertToNumber(String value, Locale locale)
- throws ConversionException {
+ protected Number convertToNumber(String value, Locale locale) {
if (value == null) {
return null;
}
@@ -79,7 +74,8 @@ public abstract class AbstractStringToNumberConverter<T>
ParsePosition parsePosition = new ParsePosition(0);
Number parsedValue = getFormat(locale).parse(value, parsePosition);
if (parsePosition.getIndex() != value.length()) {
- throw new ConversionException("Could not convert '" + value + "'");
+ throw new IllegalArgumentException(
+ "Could not convert '" + value + "'");
}
if (parsedValue == null) {
diff --git a/server/src/main/java/com/vaadin/data/util/converter/Converter.java b/server/src/main/java/com/vaadin/data/util/converter/Converter.java
index 4ccafc5384..345f8df5bf 100644
--- a/server/src/main/java/com/vaadin/data/util/converter/Converter.java
+++ b/server/src/main/java/com/vaadin/data/util/converter/Converter.java
@@ -21,7 +21,6 @@ import java.util.Locale;
import java.util.function.Function;
import com.vaadin.data.Binder.Binding;
-import com.vaadin.v7.data.util.converter.LegacyConverter.ConversionException;
import com.vaadin.data.Result;
/**
@@ -125,14 +124,12 @@ public interface Converter<PRESENTATION, MODEL> extends Serializable {
return new Converter<P, M>() {
@Override
- public Result<M> convertToModel(P value, Locale locale)
- throws ConversionException {
+ public Result<M> convertToModel(P value, Locale locale) {
return toModel.apply(value);
}
@Override
- public P convertToPresentation(M value, Locale locale)
- throws ConversionException {
+ public P convertToPresentation(M value, Locale locale) {
return toPresentation.apply(value);
}
};
diff --git a/server/src/main/java/com/vaadin/data/util/converter/StringToIntegerConverter.java b/server/src/main/java/com/vaadin/data/util/converter/StringToIntegerConverter.java
index ba7531a4d6..16dcd832dd 100644
--- a/server/src/main/java/com/vaadin/data/util/converter/StringToIntegerConverter.java
+++ b/server/src/main/java/com/vaadin/data/util/converter/StringToIntegerConverter.java
@@ -20,7 +20,6 @@ import java.text.NumberFormat;
import java.util.Locale;
import com.vaadin.data.Result;
-import com.vaadin.v7.data.util.converter.LegacyConverter.ConversionException;
/**
* A converter that converts from {@link String} to {@link Integer} and back.
@@ -66,8 +65,7 @@ public class StringToIntegerConverter
}
@Override
- public Result<Integer> convertToModel(String value, Locale locale)
- throws ConversionException {
+ public Result<Integer> convertToModel(String value, Locale locale) {
Number n = convertToNumber(value, locale);
if (n == null) {