Change Password Dialog cannot be opened without username

Jmix version: 1.1.2
Jmix Studio plugin version: 1.1.4-213
IntelliJ IDEA 2021.3 CE - Build #IC-213.5744.223, built on November 27, 2021
Operating System: macOS 12.0.1 (21A559)
File System: Case-Sensitive Journaled HFS+ (APFS)
Datebase: PostgreSQL 13

Hi Everyone

#1. After my CUBA-to-Jmix migration I deleted my ext-change-password-dialog.xml screen and controller (originally generated from a legacy screen in CUBA Studio) and generated a new Jmix ext-change-password-dialog.xml screen and controller in Jmix Studio (below). The result is basically identical to the CUBA version.

But now I cannot open the dialog and receive the following exception…

java.lang.IllegalArgumentException: Dialog cannot be opened without username
at io.jmix.core.common.util.Preconditions.checkNotNullArgument(Preconditions.java:101)
at io.jmix.securityui.screen.changepassword.ChangePasswordDialog.onAfterShow(ChangePasswordDialog.java:102)
at io.jmix.core.common.event.EventHub.publish(EventHub.java:170)
at io.jmix.ui.screen.Screen.fireEvent(Screen.java:124)

SCREEN

 <?xml version="1.0" encoding="UTF-8" standalone="no"?>

<window xmlns="http://jmix.io/schema/ui/window"
        extends="io/jmix/securityui/screen/changepassword/change-password-dialog.xml"
        xmlns:ext="http://schemas.haulmont.com/cuba/1.1/window-ext.xsd">
    <layout>
        <label value="msg://com.company.nf.web.screens.member/passwordFormatText" ext:index="0"/>
    </layout>
</window>

CONTROLLER

package com.company.nf.screen.extchangepassworddialog;

import io.jmix.ui.screen.UiController;
import io.jmix.ui.screen.UiDescriptor;
import io.jmix.securityui.screen.changepassword.ChangePasswordDialog;

@UiController("ext_ChangePasswordDialog")
@UiDescriptor("ext-change-password-dialog.xml")
public class ExtChangePasswordDialog extends ChangePasswordDialog {
}

CALLING CODE (take from my CUBA code)

private void showChangePasswordDialog() {

    screenBuilders.screen(this)
            .withScreenClass(ExtChangePasswordDialog.class)
            .withOpenMode(OpenMode.DIALOG)
            .build()
            .show();
}

This was not a problem in CUBA. What option(s) do I need to pass to screenBuilders for this? Other solution?

#2. Please also note… I added my own label to the dialog to display the required password format and when I moved it above the textFields in Studio, Studio automatically added the following line:

    xmlns:ext="http://schemas.haulmont.com/cuba/1.1/window-ext.xsd">

I assume, that this should be replaced by a Jmix reference. Any suggestions about this? Ignore it for now? Remove it?

Best regards
Chris

Sorry, I completely forgot to mention that the dialog is actually displayed after the error dialog is displayed. And after I enter the new password I receive the following error:

IllegalArgumentException: Null userName

#1. The dialog’s controller has with... setters:

screenBuilders.screen(this)
        .withScreenClass(ExtChangePasswordDialog.class)
        .withOpenMode(OpenMode.DIALOG)
        .build()
        .withCurrentPasswordRequired(true)
        .withUsername(currentAuthentication.getUser().getUsername())
        .show();

#2. Created issue: https://youtrack.jmix.io/issue/JST-2469. Thanks for reporting it!

You can replace it with xmlns:ext="http://jmix.io/schema/ui/window-ext" (however it doesn’t affect the runtime).

Hi Konstantin

Thank you for the information and especially for pointing out my bad habit of not checking the options after the “build” method. I haven’t looked there once in the past 6 months; it wasn’t necessary.

I didn’t see this option listed with the others in the code completion (1st image below) and didn’t find it in the documentation and immediately thought that something was missing somewhere else. Therefore, I didn’t think to check after “build” (2nd image below).

My mistake; sorry for wasting your time!

Thanks for the other hint and the issue.

Best regards
Chris

Screenshot 2021-12-30 at 22.58.25 Uhr

Screenshot 2021-12-30 at 22.46.27 Uhr