[MGNLUI-5895] Prevent NPE for sub-forms of switchableField Created: 26/May/20  Updated: 02/Jun/20  Resolved: 02/Jun/20

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 6.2, 6.2.1
Fix Version/s: 6.2.2

Type: Improvement Priority: Neutral
Reporter: Oanh Thai Hoang Assignee: Oanh Thai Hoang
Resolution: Fixed Votes: 0
Labels: maintenance
Remaining Estimate: 0d
Time Spent: 0.25d
Original Estimate: Not Specified

Attachments: Zip Archive hello-magnolia.zip    
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)
Sprint: Maintenance 9
Story Points: 1

 Description   

Step to reproduce:

  • Prepare one form has switchable field without sub-forms or use my attached template (hello-magnolia.zip)
  • Add new template component has configure switchable field without sub-forms
  • See error log
 Caused by: info.magnolia.objectfactory.MgnlInstantiationException: Failed to create instance of [class info.magnolia.ui.editor.FormView]Caused by: info.magnolia.objectfactory.MgnlInstantiationException: Failed to create instance of [class info.magnolia.ui.editor.FormView] at info.magnolia.objectfactory.guice.GuiceComponentProvider.newInstanceWithParameterResolvers(GuiceComponentProvider.java:138) at info.magnolia.ui.framework.ioc.UiComponentProvider.lambda$newInstanceWithParameterResolvers$3(UiComponentProvider.java:137) at info.magnolia.ui.framework.ioc.UiComponentProvider.provideInCurrentScope(UiComponentProvider.java:177) at info.magnolia.ui.framework.ioc.UiComponentProvider.newInstanceWithParameterResolvers(UiComponentProvider.java:137) at info.magnolia.ui.framework.ioc.UiComponentProvider.newInstance(UiComponentProvider.java:128) at info.magnolia.ui.UIComponent.create(UIComponent.java:139) at info.magnolia.ui.UIComponent.create(UIComponent.java:126) at info.magnolia.ui.dialog.actions.OpenDialogAction.execute(OpenDialogAction.java:103) at info.magnolia.pages.app.detail.action.CreateComponentAction.lambda$execute$0(CreateComponentAction.java:142) at com.machinezoo.noexception.CheckedExceptionHandler.run(CheckedExceptionHandler.java:1709) at info.magnolia.pages.app.detail.action.CreateComponentAction.execute(CreateComponentAction.java:101) at info.magnolia.ui.api.action.AbstractActionExecutor.execute(AbstractActionExecutor.java:62) ... 126 moreCaused by: info.magnolia.objectfactory.MgnlInstantiationException: Failed to create an instance with c-tor [FormView(FormDefinition, LocaleContext)] at info.magnolia.objectfactory.ObjectManufacturer.newInstance(ObjectManufacturer.java:131) at info.magnolia.objectfactory.ObjectManufacturer.newInstance(ObjectManufacturer.java:99) at info.magnolia.objectfactory.guice.GuiceComponentProvider.newInstanceWithParameterResolvers(GuiceComponentProvider.java:134) ... 137 moreCaused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at info.magnolia.objectfactory.ObjectManufacturer.newInstance(ObjectManufacturer.java:129) ... 139 moreCaused by: info.magnolia.objectfactory.MgnlInstantiationException: Failed to create instance of [class info.magnolia.ui.editor.SwitchableFormView] at info.magnolia.objectfactory.guice.GuiceComponentProvider.newInstanceWithParameterResolvers(GuiceComponentProvider.java:138) at info.magnolia.ui.framework.ioc.UiComponentProvider.lambda$newInstanceWithParameterResolvers$3(UiComponentProvider.java:137) at info.magnolia.ui.framework.ioc.UiComponentProvider.provideInCurrentScope(UiComponentProvider.java:177) at info.magnolia.ui.framework.ioc.UiComponentProvider.newInstanceWithParameterResolvers(UiComponentProvider.java:137) at info.magnolia.ui.framework.ioc.UiComponentProvider.newInstance(UiComponentProvider.java:128) at info.magnolia.ui.UIComponent.create(UIComponent.java:139) at info.magnolia.ui.UIComponent.create(UIComponent.java:126) at info.magnolia.ui.editor.FormView.createSubEditor(FormView.java:121) at info.magnolia.ui.editor.FormView.lambda$null$1(FormView.java:107) at java.util.ArrayList.forEach(ArrayList.java:1257) at info.magnolia.ui.editor.FormView.lambda$createComplexProperties$2(FormView.java:105) at java.util.ArrayList.forEach(ArrayList.java:1257) at info.magnolia.ui.editor.FormView.createComplexProperties(FormView.java:98) at info.magnolia.ui.editor.FormView.<init>(FormView.java:88) ... 144 moreCaused by: info.magnolia.objectfactory.MgnlInstantiationException: Failed to create an instance with c-tor [SwitchableFormView(SwitchableFormDefinition, PropertySetFactory, LocaleContext)] at info.magnolia.objectfactory.ObjectManufacturer.newInstance(ObjectManufacturer.java:131) at info.magnolia.objectfactory.ObjectManufacturer.newInstance(ObjectManufacturer.java:99) at info.magnolia.objectfactory.guice.GuiceComponentProvider.newInstanceWithParameterResolvers(GuiceComponentProvider.java:134) ... 157 moreCaused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at info.magnolia.objectfactory.ObjectManufacturer.newInstance(ObjectManufacturer.java:129) ... 159 moreCaused by: java.lang.NullPointerException at info.magnolia.ui.editor.SwitchableFormView.<init>(SwitchableFormView.java:88) ... 164 more

 

Expectation: Prevent NPE like multi field https://git.magnolia-cms.com/projects/PLATFORM/repos/ui/commits/abdbe37814432c96ca0ffdcc702f2f6ddbc5cce0


Generated at Mon Feb 12 09:31:07 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.