Vaadin 7.1: ReadOnlyException in addComponent()

I updated the Vaadin libs in my app from 7.0.7 to 7.1.1 and now I’m getting an error during construction of a form if a field is set to read-only.

The relevant code looks like this:

FormLayout fl = new FormLayout();
FieldGroup fg = new FieldGroup();
TextField f = new TextField();

fgQuote.bind(f, "fieldname");

This used to work in 7.0.
After updating to 7.1 the last line causes this exception:


Caused by:$ReadOnlyException
	at com.vaadin.ui.AbstractField.setValue(
	at com.vaadin.ui.AbstractField.setValue(
	at com.vaadin.ui.AbstractTextField.setValue(
	at com.vaadin.ui.AbstractTextField.setValue(
	at com.vaadin.ui.AbstractField.setConvertedValue(
	at com.vaadin.ui.AbstractField.localeMightHaveChanged(
	at com.vaadin.ui.AbstractField.attach(
	at com.vaadin.ui.AbstractComponent.setParent(
	at com.vaadin.ui.AbstractComponentContainer.addComponent(

My work-around is to call f.setReadOnly(true) after fl.addComponent(f) - then it works again.

Question: Is this intended behaviour or maybe a bug?

If you look at it from a logical standpoint, it makes sense:
You are trying to assign a value (in the bind method) to a textfield which is readonly.
The only slightly weird thing is that it worked before 7.1.0. Maybe they changed something in the bind method or the readonly-method.
For safety I would always recommend you to use setReadonly only after you set the value/binding of a field.
The way it worked before sounds more like a bug to me then the current behavior.