Hide Forgot
I was updating a plugin configuration for an existing plugin with a new additional property. Server showed Caused by: java.lang.NullPointerException at org.rhq.enterprise.server.resource.metadata.PluginConfigurationMetadataManagerBean.updateResourcePluginConfiguration(PluginConfigurationMetadataManagerBean.java:109) at org.rhq.enterprise.server.resource.metadata.PluginConfigurationMetadataManagerBean.updatePluginConfigurationDefinition(PluginConfigurationMetadataManagerBean.java:83) Code is: Property templateProperty = templateConfiguration.get(propertyDef.getName()); pluginConfiguration.put(templateProperty.deepCopy(false)); Issue is that templateConfiguration only has the old definitions and is lacking the new one. So templateProperty is null and the update bombs.
Heiko So you are saying we can't add a property to the plugin configuration of an existing resource? I'm sure we've done this before, e.g. the support facet work added lots of new properties. Can you determine what's going on here?
I don't recall the details. Looking at master shows that I've added a null-check for this case back in July (probably got annoyed while working on as7 plugin) and forgot to add this here. Property templateProperty = templateConfiguration.get(propertyDef.getName()); + if (templateProperty==null) { + throw new IllegalArgumentException("The property [" + propertyDef.getName() + + "] marked as required in the configuration definition of [" + propertyDef.getConfigurationDefinition().getName() + + "] has no attribute 'default'"); + } else { pluginConfiguration.put(templateProperty.deepCopy(false)); This prevents the NPE and gives the plugin writer a hint what he has done wrong. Commit is ae90811cb167e8e8c20cb4677fe1e7580714db51 in master (as of July 2011)