CRUD component issue

I have found strange behaviour in Vaadin CRUD component. Here is my code for setting up an editor:

private static BinderCrudEditor<Product> createForm() {
		TextField name = new TextField("Product name");
		name.getElement().setAttribute("colspan", "2");
		TextField quantity = new TextField("Quantity");
		DatePicker manufacturedDate = new DatePicker("Manufactured Date");
		TextField price = new TextField("Unit price");
		price.getElement().setAttribute("colspan", "2");
		FormLayout form = new FormLayout(name, quantity, manufacturedDate, price);
		BeanValidationBinder<Product> binder = new BeanValidationBinder<>(Product.class);
		binder.bind(name, "name");
		binder.forField(quantity).withConverter(new StringToIntegerConverter("Please enter the number")).bind("quantity");

When new product creates the last line of this code always gives runtime exception (java.lang.RuntimeException: Unable to instantiate new bean) caused by java.lang.NullPointerException: Null value is not supported. Anyway it does not prevent an application from execution and it is possible for users to create a product, but it gives huge error stack in log file everytime then user creates product. To overcome I have implemented my own version of StringToIntegerConverter, but I am not sure that this is the right way.

Any suggestions?

I also have this problem. When I add binder.forField(…).asRequired(“Required”) then exception not occur. Maybe is bug.

To overcome I have implemented my own version of StringToIntegerConverter, but I am not sure that this is the right way.

How you implemented StringToIntegerConverter ?

import com.vaadin.flow.data.binder.Result;
import com.vaadin.flow.data.binder.ValueContext;
import com.vaadin.flow.data.converter.Converter;

public class StringToIntegerConverter implements Converter<String, Integer> {
		
		private String errorMessage;
		
		public StringToIntegerConverter(String errorMessage) {
	        this.errorMessage = errorMessage;
	    }
		
		// Should never fail, so returns PRESENTATION type
		public String convertToPresentation(Integer value, ValueContext context) {
			if (value != null) return String.format(context.getLocale().get(), "%d", value);
			return "";
		}

		// Might fail, so returns a Result instead of throwing an Exception
		public Result<Integer> convertToModel(String value, ValueContext context) {
			try {
				return Result.ok(Integer.parseInt(value));
			} catch (NumberFormatException ex) {
				return Result.error(errorMessage);
			}
		}
	}