icfnext / cq-component-maven-plugin

Other
22 stars 35 forks source link

Unable to nest @DialogFieldSet annotations #7

Closed kand closed 8 years ago

kand commented 10 years ago

If you have a component class layout such as this:

MyParentComponent

@DialogFieldSet( namePrefix = "child1" ) private MyChildComponent childComponent1; @DialogFieldSet( namePrefix = "child2" ) private myChildComponent childComponent2;

MyChildComponent

@DialogFieldSet private someOtherComponent otherComponent

And attempt to build this nested layout, the following error occurs:

java.lang.NullPointerException at com.citytechinc.cq.component.dialog.dialogfieldset.DialogFieldSetWidgetMaker.buildWidgetCollection(DialogFieldSetWidgetMaker.java:110) at com.citytechinc.cq.component.dialog.dialogfieldset.DialogFieldSetWidgetMaker.make(DialogFieldSetWidgetMaker.java:75) at com.citytechinc.cq.component.dialog.factory.WidgetFactory.make(WidgetFactory.java:61) at com.citytechinc.cq.component.dialog.factory.DialogFactory.make(DialogFactory.java:127) at com.citytechinc.cq.component.dialog.util.DialogUtil.buildDialogsFromClassList(DialogUtil.java:176) at com.citytechinc.cq.component.maven.util.ComponentMojoUtil.buildArchiveFileForProjectAndClassList(ComponentMojoUtil.java:239) at com.citytechinc.cq.component.maven.ComponentMojo.execute(ComponentMojo.java:100) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133) ...

I believe this is related to the fact that DialogFieldSet objects do not get built with a name parameter that is populated. The maker is attempting to build a name for the properties in the nested dialog field set and name is null for the DialogFieldSet, so an NPE occurs.

pmichelotti commented 8 years ago

This was fixed some time ago

kand commented 8 years ago

:+1:

cmacioch commented 7 years ago

@pmichelotti @michaelhodgdon I am running into the same issue. I get NPE when nesting DialogFieldSet widgets. I am on the latest version of the component plugin. Is there any specific way the annotations should be set up?