null LoginI18n in Vaadin 23

I am building a LoginForm and wanted to customize the i18n, but it seems to be null.

Here’s the nested exception:
Cannot invoke "com.vaadin.flow.component.login.LoginI18n$Header.setTitle(String)" because "header" is null.

And the code is:

public LoginI18n getLoginI18n() {
        LoginI18n i18n = LoginI18n.createDefault();

        LoginI18n.Header header = i18n.getHeader();

The default has no header information. You can pass your own header by using setHeader

Well I didn’t think about that and it now compiles but… the header doesn’t show up.

If you add text in the header it should

That’s what I did

LoginI18n.Header header = new LoginI18n.Header();
header.setTitle("The title");
header.setDescription("The description");

can you show all the code? Do you set the header before you call getHeader?

I do not use getHeader() now.

my code now does this

public LoginI18n getLoginI18n() {
    LoginI18n i18n = LoginI18n.createDefault();

    LoginI18n.Header header = new LoginI18n.Header();
    header.setTitle("FreeTransfer Account");
    header.setDescription("Send files easier and keep track of your past actions!");

    LoginI18n.Form form = i18n.getForm();
    form.setTitle("Log in");
    form.setSubmit("Log in");
    form.setForgotPassword("Forgot password? We'll help you");

    LoginI18n.ErrorMessage errorMessage = i18n.getErrorMessage();
    errorMessage.setTitle("Something went wrong");
            "Check that you have entered the correct username and password and try again.\nIf you forgot yor password, we can help you.");

    i18n.setAdditionalInformation("If you are running into login issues, please contact the dev:");

    return i18n;

Heres the entire method

That’s more or less the same as I do and this works fine: jtaf4/src/main/java/ch/jtaf/ui/view/ at develop · 72services/jtaf4 · GitHub

After a bit of coding it now works, thanks!

What was the issue`?

Tbh I really don’t know… I just changed from doing like

LoginI18n.Something obj = new LoginI18n.Something();


i18n.setSomething(new LoginI18n.Something());

and it now works.

I’m pretty new to Spring, so I’ll remember this.