[MGNLUI-3640] "Jump to next error" causes NullPointerException when on "Show all" tab Created: 02/Nov/15  Updated: 20/Apr/17  Resolved: 20/Apr/17

Status: Closed
Project: Magnolia UI
Component/s: dialogs
Affects Version/s: 5.3, 5.4, 5.5.2
Fix Version/s: 5.5.4

Type: Bug Priority: Major
Reporter: Cedric Reichenbach Assignee: Ngoc Nguyenthanh
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 4d 5.25h
Original Estimate: 4d

Issue Links:
Relates
relation
is related to MGNLUI-3945 Jump to next error doesn't work with ... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Testcase included:
Yes
Date of First Response:
Sprint: Saigon 89, Saigon 90, Saigon 91, Saigon 92
Story Points: 8

 Description   

Steps to reproduce:

  1. Open edit dialog of a contact in the contacts app, e.g. https://demo.magnolia-cms.com/.magnolia/admincentral#app:contacts:detail;/jbach:edit
  2. Switch to tab SHOW ALL
  3. Remove content of a required field, e.g. Last name
  4. Click save (error messages appear)
  5. Click Jump to next error


 Comments   
Comment by Ngoc Nguyenthanh [ 17/Apr/17 ]
Root cause
  • currentFocused parameter from Form#doFocusNextProblematicField is null in some cases.
  • currentFocused is sended from client side on ActiveTabChangeEvent in FormViewImpl
    • Auto focus first field in case of there is no error. Otherwise do nothing => currentFocused is always null when has error.
    • In case of showing all tabs, the active tab is null. So that it will not trigger ActiveTabChangedEvent in MagnoliaTabSheetConnector in state changed. Consequently, onConnectorHierarchyChange will not fired in FormSectionConnector to set the content. It lead to FormViewImpl.focusFirstFieldInTab fails due to tab.getFields() return empty.
    • The ActiveTabChangedEvent will be fired 2 times because of evenBus circular. First time always fails because can not getFields. The second time, it works.
Solution
  • Prevent failing when tab.getFields in FormViewImpl.focusFirstFieldInTab because of 2 times calling.
  • Start iterate for parent tab of currentFocused in Form or active tab or the first tab in case of has error.
Generated at Mon Feb 12 09:08:40 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.