[MGNLPN-641] EditComponent uses deprecated constructor which does not inject LanguageSelectorView Created: 20/Jun/22  Updated: 23/Aug/22  Resolved: 18/Jul/22

Status: Closed
Project: Magnolia Personalization
Component/s: None
Affects Version/s: None
Fix Version/s: 2.1.4

Type: Bug Priority: Neutral
Reporter: Carlos Cantalapiedra Assignee: Milan Divilek
Resolution: Fixed Votes: 2
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: PNG File 1.Creating-component.png     PNG File 2.Edit-component-1.png     PNG File 3.Edit-component-2.png     PNG File 4.Close-null.png     HTML File stacktrace-languagueSelector    
Issue Links:
Problem/Incident
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLPN-664 Implementation Sub-task Completed Milan Divilek  
MGNLPN-665 Review Sub-task Completed Jaroslav Simak  
MGNLPN-666 piQA Sub-task Completed Jaroslav Simak  
MGNLPN-667 QA Sub-task Completed Robert Šiška  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: Support
Sprint: DevX 14
Story Points: 2
Team: DeveloperX

 Description   

Description

When creating / editing a component, the EditElementAction is called but the constructor call discriminates between if you are creating or editing a component.

If you create a new component, the default constructor is used which injects the LanguajeSelectorView object, so if you have a custom implementation of this class, it will be passed and used:

On this point, everything works smoothly. But if you edit the component, then the Deprecated constructor is used which has no LanguageSelectorView parameter and nothing is passed:

So the component is a built with a null LanguageSelectorView object:

Once you have modified the component and try to save it, the getCloserHandler is called, it fails with a nullPointer because the LanguageSelectorView object is truly a null:

Expected result

The editComponent uses the non deprecated constructor, which passes the LanguageSelectorView object

Actual result

The editComponent uses the deprecated constructor, which does not inject the LanguageSelectorView object, so the closerHandler fails with a nullPointer

Dev notes:

Full stacktrace attached



 Comments   
Comment by Siegfried Zach [ 20/Jun/22 ]

Note: The problem is probably coming from the magnolia-personalization module. It decorates the editComponent action to use info.magnolia.pages.app.detail.action.VariantAwareEditElementActionDefinition. The implementation class (VariantAwareEditElementAction) is then directly calling the deprecated constructor of EditElementAction. So I would assume using the standard constructor here fixes the problem.

Generated at Mon Feb 12 06:39:39 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.