Index: addon-cms/src/main/java/org/onehippo/forge/selection/frontend/plugin/DynamicDropdownPlugin.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- addon-cms/src/main/java/org/onehippo/forge/selection/frontend/plugin/DynamicDropdownPlugin.java (revision 1346) +++ addon-cms/src/main/java/org/onehippo/forge/selection/frontend/plugin/DynamicDropdownPlugin.java (revision ) @@ -51,6 +51,7 @@ import org.hippoecm.frontend.model.event.IEvent; import org.hippoecm.frontend.model.event.IObserver; import org.hippoecm.frontend.model.event.Observer; +import org.hippoecm.frontend.model.properties.JcrPropertyModel; import org.hippoecm.frontend.model.properties.JcrPropertyValueModel; import org.hippoecm.frontend.plugin.IPluginContext; import org.hippoecm.frontend.plugin.config.IPluginConfig; @@ -84,7 +85,7 @@ * regular option elements. Groups and options without a group are shown in the order they are encountered in the * {@link org.onehippo.forge.selection.frontend.model.ValueList} used. */ -public class DynamicDropdownPlugin extends RenderPlugin { +public class DynamicDropdownPlugin extends RenderPlugin { private static final String SERVICE_VALUELIST_DEFAULT = "service.valuelist.default"; @@ -100,12 +101,17 @@ // check the cnd for multiple, this is not supported (NB: check doesn't work for relaxed cnd) try { + final JcrPropertyModel jcrPropertymodel = getValueModel().getJcrPropertymodel(); + if (jcrPropertymodel != null) { - final boolean multiple = getValueModel().getJcrPropertymodel().getProperty().getDefinition().isMultiple(); - if (multiple) { - throw new IllegalStateException(this.getClass().getName() + " does not support fields that are multiple, " + - "please use " + DynamicMultiSelectPlugin.class.getName() + " for that." + - " Field name is " + getValueModel().getJcrPropertymodel().getProperty().getDefinition().getName() + "."); - } + final boolean multiple = getValueModel().getJcrPropertymodel().getProperty().getDefinition().isMultiple(); + if (multiple) { + throw new IllegalStateException(this.getClass().getName() + " does not support fields that are multiple, " + + "please use " + DynamicMultiSelectPlugin.class.getName() + " for that." + + " Field name is " + getValueModel().getJcrPropertymodel().getProperty().getDefinition().getName() + "."); + } + } else { + log.info("jcrproperty model in DynamicDropDownplugin is null while trying to retrieve is multiple"); + } } catch (RepositoryException e) { throw new InstantiationError("Error instantiating " + this.getClass().getName() + ": " + e.getMessage()); } @@ -122,7 +128,7 @@ final String observerId = config.getString(Config.OBSERVER_ID); if (StringUtils.isNotEmpty(observerId)) { - context.registerTracker(new ServiceTracker(IModelReference.class){ + context.registerTracker(new ServiceTracker(IModelReference.class) { private Observer observer; @@ -207,8 +213,7 @@ if ("edit".equals(mode)) { replace(createSelect(valueList)); DynamicDropdownPlugin.this.redraw(); - } - else { + } else { Label label = createValueLabel(valueList, mode); replace(label); } \ No newline at end of file