password equals validation with databinding: password is randomly null

Hi,

I use the following validator (see below) for a password and a password repeated field.
Data is bound to the passwordNew field using a non-buffered FieldGroup.

It happens that sometimes the password obtained from the FieldGroup is null.
This happens randomly and not reproduceably. It works for some time, and later it doesn’t work for some time.

Does somebody have an idea what might cause this problem?

private PasswordField passwordNew = ...;
private PasswordField passwordNewRepeated = ...;

passwordNew.setImmediate(true);
passwordNew.addValidator(new PasswordsEqualsValidator("passwords not equal!");

passwordNewRepeated.setImmediate(true);
passwordNewRepeated.addValueChangeListener(e -> {
    passwordNew.markAsDirty();
    passwordNew.isValid();
});

class PasswordsEqualsValidator extends AbstractStringValidator
{
    public PasswordsEqualsValidator(String errorMessage)
    {
        super(errorMessage);
    }

    @Override
    protected boolean isValidValue(String value)
    {
        String pwd = value;
        String pwdRepeated = (String) passwordNewRepeated.getValue();

        return pwdRepeated != null && pwdRepeated.equals(pwd);
    }
}

EDIT: it even occurs when I comment out line 4 and lines 7-11
Vaadin 7.4.3 is used

After further investigation I am pretty sure that line 24

String pwdRepeated = (String) passwordNewRepeated.getValue(); causes these problems.

The fieldgroup contains the right value for passwordNew (inspecting fieldToPropertyId value in debugger), only the model value is null.

The fieldgroup is a BeanFieldGroup, the bindMemberFields() method is used for databinding.

Update: It works using a buffered field group.

Explanation for my problems above: Only if validation successes the value of the password field is written to the model. => passwordNew and passwordNewRepeated not equal => not written to model => model is null

this is the same scenario as in https://dev.vaadin.com/ticket/8096, but there is no mentioning that it only works in buffered mode…

I also have these problems with a custom DateFromToValidator(validates two DateField and ensures that the TO value is after or equals the FROM value, constructed similar as the password validator above) in nonbuffered mode. If I enter a wrong FROM value and then make it right again adjusting the TO value, than it is not written back to model…

see also http://stackoverflow.com/questions/23286881/strategy-for-cross-field-validation-in-vaadin

Can anybody confirm these problems? Is this a bug of vaadin or is it by design?