/*
 * Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
 * Haulmont Technology proprietary and confidential.
 * Use is subject to license terms.
 */

package com.haulmont.cuba.web.toolkit.ui.converters;

import com.vaadin.data.util.converter.Converter;

import java.util.Locale;

/**
 * @author artamonov
 * @version $Id$
 */
public class SimpleStringToIntegerConverter implements Converter<String, Integer> {

    @Override
    public Integer convertToModel(String value, Class<? extends Integer> targetType, Locale locale)
            throws ConversionException {
        return Integer.parseInt(value);
    }

    @Override
    public String convertToPresentation(Integer value, Class<? extends String> targetType, Locale locale)
            throws ConversionException {
        return String.valueOf(value);
    }

    @Override
    public Class<Integer> getModelType() {
        return Integer.class;
    }

    @Override
    public Class<String> getPresentationType() {
        return String.class;
    }
}
@@ -260,16 +260,60 @@
 nverter;
+%0Aimport org.apache.commons.lang.StringUtils;
 %0A%0Aimport
@@ -610,32 +610,110 @@
 sionException %7B%0A
+        if (StringUtils.isEmpty(value)) %7B%0A            return null;%0A        %7D%0A%0A
         return I
@@ -855,32 +855,32 @@
  Locale locale)%0A
-
             thro
@@ -896,32 +896,95 @@
 sionException %7B%0A
+        if (value == null) %7B%0A            return %22%22;%0A        %7D%0A%0A
         return S

Fix SimpleStringToIntegerConverter NumberFormatException