| Summary: | NPE on update of plugin config for existing resources | ||
|---|---|---|---|
| Product: | [Other] RHQ Project | Reporter: | Heiko W. Rupp <hrupp> |
| Component: | Core Server | Assignee: | Heiko W. Rupp <hrupp> |
| Status: | CLOSED NEXTRELEASE | QA Contact: | Mike Foley <mfoley> |
| Severity: | high | Docs Contact: | |
| Priority: | medium | ||
| Version: | 4.0.0.Beta2 | CC: | hrupp, loleary |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2011-10-21 21:24:50 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Bug Depends On: | |||
| Bug Blocks: | 734807 | ||
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)
|
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.