Revision 4b91c104
Added by Andreas Kohlbecker about 6 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/util/converter/UriConverter.java | ||
---|---|---|
47 | 47 |
public URI convertToModel(String value, Class<? extends URI> targetType, Locale locale) |
48 | 48 |
throws com.vaadin.data.util.converter.Converter.ConversionException { |
49 | 49 |
if(value != null){ |
50 |
try{ |
|
51 |
URI uri = new URI(value); |
|
52 |
return uri; |
|
53 |
} catch (Exception e){ |
|
54 |
throw new com.vaadin.data.util.converter.Converter.ConversionException(e); |
|
50 |
value = value.trim(); |
|
51 |
if(!value.isEmpty()){ |
|
52 |
try{ |
|
53 |
URI uri = new URI(value.trim()); |
|
54 |
return uri; |
|
55 |
} catch (Exception e){ |
|
56 |
throw new com.vaadin.data.util.converter.Converter.ConversionException(e); |
|
57 |
} |
|
55 | 58 |
} |
56 | 59 |
} |
57 | 60 |
return null; |
Also available in: Unified diff
stripping whitespace before URI conversion