'EMail Notifier' form issue


[ TeamCity Enterprise Version 5.0 EAP (build 10626) ]

There is the bug (?) in the 'EMail Notifier' web form ('Administration' -> 'Server Configuration' -> 'EMail Notifier').
When this form has been loaded (it was first TeamCity launch, e. g.) any user action (for example changing cursor position in some text field without any field value changes) causes the popup to be shown in the bottom of page with warning 'Changes not yet saved' though no changes were made.

This problem occurs because of the following condition in the method isFieldModified() of RememberState class and fields cache state of this class:

if(remembered != null && current != null && remembered.equals(current))
    return false;

At first, before calling that method to check any bean field modifications, in the initialization time the fields of SettingsBean (child of RememberState) were filled with data from EMailNotificatorConfig class (and the fields 'myUsername1' and 'myPassword1' were null references by default).

After when user did anything on the form and event handler was fired at editSettings.jsp the SettingsBean fields were filled with data from web form elements (text fields). And java bean fields has become empty strings ('') instead of previous null values.

But in the cache 'myRememberedState' of class RememberState all cached objects have old values. String objects have null references and it brings to incorrect condition results.This condition is passed through and the last line of method can be executed (return true).

Sure it's not critical bug, but actually it's quite strange to see notification about some changes when nothing happened.

PS

[server-api.jar]
    jetbrains.buildServer.controllers.RememberState

[email-notificator.jar]
    jetbrains.buildServer.controllers.email.SettingsBean
    jetbrains.buildServer.notification.email.EMailNotificatorConfig

TeamCity/webapps/ROOT/plugins/email/editSettings.jsp




Attachment(s):
bug.jpg
1 comment
Comment actions Permalink

Thank you very much for such indepth analysis! The bug will be fixed in TeamCity 5.0

0

Please sign in to leave a comment.