Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-5895

Prevent NPE for sub-forms of switchableField

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 6.2.2
    • 6.2, 6.2.1
    • None
    • Maintenance 9
    • 1

      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

        Acceptance criteria

              oanh.thai Oanh Thai Hoang
              oanh.thai Oanh Thai Hoang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0d
                    0d
                    Logged:
                    Time Spent - 0.25d
                    0.25d