vaadin / vaadin/framework

Binder should report the property name in binding error messages if available

Open
#9,450 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

  • Vaadin version: 8.1.0.beta1, still exists in 8.3.2

If a developer makes name based binding, and it misses a converter, it can be hard for developer to find the right binding that should be fixed. Binder should included the name of the bound property in the error message if known. Especially nasty if there are multiple field type - editor type pairs of which some are configured.

An example to reproduce:

public static class Pojo {
    private String stringValue;
    private Double doubleValue;

    public Double getDoubleValue() {
        return doubleValue;
    }

    public String getStringValue() {
        return stringValue;
    }

    public void setDoubleValue(Double doubleValue) {
        this.doubleValue = doubleValue;
    }

    public void setStringValue(String stringValue) {
        this.stringValue = stringValue;
    }
    
} 

TextField stringValue = new TextField();
TextField doubleValue = new TextField();

{
    Binder<Pojo> binder = new Binder<>(Pojo.class);
    binder.bindInstanceFields(this);
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Binder.bindInstanceFields using the Pojo and two TextField example from the issue, and reproduce the missing-converter binding error. The work is done when the error message includes the bound property name whenever that name is available, making the failing binding identifiable.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.