From 62d3977c3bd2f63146eaf009db46d74a236e6214 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Sun, 17 Jan 2016 14:03:53 +0200 Subject: Propertly handle null in StringToCollectionConverter (#19481) Change-Id: I9a01528910c5f9ec830e236fd8acd78dda763f24 --- .../vaadin/data/util/converter/StringToCollectionConverter.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'server/src/com/vaadin') diff --git a/server/src/com/vaadin/data/util/converter/StringToCollectionConverter.java b/server/src/com/vaadin/data/util/converter/StringToCollectionConverter.java index b86fec5558..6930b6da06 100644 --- a/server/src/com/vaadin/data/util/converter/StringToCollectionConverter.java +++ b/server/src/com/vaadin/data/util/converter/StringToCollectionConverter.java @@ -145,6 +145,10 @@ public class StringToCollectionConverter implements public Collection convertToModel(String value, Class targetType, Locale locale) throws Converter.ConversionException { + if (value == null) { + return null; + } + int index = value.indexOf(delimiter); int previous = 0; Collection result = factory.createCollection(targetType); @@ -163,6 +167,9 @@ public class StringToCollectionConverter implements public String convertToPresentation(Collection value, Class targetType, Locale locale) throws Converter.ConversionException { + if (value == null) { + return null; + } StringBuilder builder = new StringBuilder(); Converter converter = tokenConverter; for (Iterator iterator = value.iterator(); iterator.hasNext();) { -- cgit v1.2.3