BooleanFormPropertyRenderer: java.lang.IllegalArgumentException: CheckBox only accepts Boolean values

Description

In class BooleanFormPropertyRenderer a com.vaadin.ui.CheckBox is instantiated in method getPropertyField. The gist of the issue if that there is a checkBox.setValue call that leads to the following stack trace:

Caused by: java.lang.IllegalArgumentException: CheckBox only accepts Boolean values
at com.vaadin.ui.Button.setInternalValue(Button.java:546)
at com.vaadin.ui.AbstractField.setValue(AbstractField.java:493)
at com.vaadin.ui.AbstractField.setValue(AbstractField.java:451)
at org.activiti.explorer.ui.form.BooleanFormPropertyRenderer.getPropertyField(BooleanFormPropertyRenderer.java:39)
at org.activiti.explorer.ui.form.FormPropertiesComponent.setFormProperties(FormPropertiesComponent.java:69)
at org.activiti.explorer.ui.form.FormPropertiesForm.setFormProperties(FormPropertiesForm.java:75)
at org.activiti.explorer.ui.task.TaskDetailPanel.initTaskForm(TaskDetailPanel.java:306)
at org.activiti.explorer.ui.task.TaskDetailPanel.init(TaskDetailPanel.java:118)
at org.activiti.explorer.ui.task.TaskDetailPanel.attach(TaskDetailPanel.java:99)
at com.vaadin.ui.AbstractComponent.setParent(AbstractComponent.java:570)
at com.vaadin.ui.AbstractComponentContainer.addComponent(AbstractComponentContainer.java:211)
at com.vaadin.ui.GridLayout.addComponent(GridLayout.java:223)
at org.activiti.explorer.ui.AbstractPage.setDetailComponent(AbstractPage.java:137)
at org.activiti.explorer.ui.task.TaskPage.access$000(TaskPage.java:44)
at org.activiti.explorer.ui.task.TaskPage$1.valueChange(TaskPage.java:116)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:490)
... 44 more

The solution, in my mind, is to pass in what we know to be a Boolean:

@Override
public Field getPropertyField(FormProperty formProperty) {

CheckBox checkBox = new CheckBox(getPropertyLabel(formProperty));
checkBox.setRequired(formProperty.isRequired());
checkBox.setEnabled(formProperty.isWritable());

if (formProperty.getValue() != null) {
Boolean value = new Boolean(Boolean.parseBoolean(formProperty.getValue())); // BUG FIX
checkBox.setValue(value);
}

return checkBox;
}

Environment

Not relevant.

Assignee

Frederik Heremans

Reporter

Nico de Wet

Labels

None

Components

Fix versions

Affects versions

Priority

Minor
Configure