Bug 725417

Summary: NPE on plugin update
Product: [Other] RHQ Project Reporter: Heiko W. Rupp <hrupp>
Component: Core ServerAssignee: Heiko W. Rupp <hrupp>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 4.1CC: hrupp
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-07-28 18:29:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Heiko W. Rupp 2011-07-25 12:27:59 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Heiko W. Rupp 2011-07-25 12:29:56 UTC
*argh* I <censored> BZ

Null pointer exception in plugin update - perhaps having to do with making an  property required which was not before

javax.ejb.EJBTransactionRolledbackException: java.lang.NullPointerException
      at $Proxy333.updatePluginConfigurationDefinition(Unknown Source)
        at org.rhq.enterprise.server.resource.metadata.ResourceMetadataManagerBean.mergeExistingType(ResourceMetadataManagerBean.java:394)
        at org.rhq.enterprise.server.resource.metadata.ResourceMetadataManagerBean.updateType(ResourceMetadataManagerBean.java:375)
        at org.rhq.enterprise.server.resource.metadata.ResourceMetadataManagerBean.updateTypes(ResourceMetadataManagerBean.java:141)
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)

Comment 2 Heiko W. Rupp 2011-07-25 12:42:39 UTC
            if (propertyDef.isRequired()) {
                Property templateProperty = templateConfiguration.get(propertyDef.getName());


TemplateProperty can be null if the entry in the descriptor has no 'default' attribute set.
Unfortunately it is close to unclear when to use 'defaultValue' and when 'default'

Bad definition:


            <c:simple-property name="startScript" type="file" defaultValue="bin/standalone.sh" description="Script used to start the server. If the path is not absolute, it is relative to the base directory"/>

in the plugin-configuration of a plugin.


I am not sure if we should only log a big fat error or throw an exception here (which describes what went wrong).

Comment 3 Heiko W. Rupp 2011-07-25 15:26:13 UTC
If the attribute 'default' is not present on a required property, a more descriptive exception is now thrown:

17:20:40,331 ERROR [ProductPluginDeployer] Failed to register RHQ plugin file [file:/im/dev-container/jbossas/server/default/deploy/rhq.ear/rhq-downloads/rhq-plugins/rhq-jboss-as-7-plugin-4.1.0-SNAPSHOT.jar]
javax.ejb.EJBTransactionRolledbackException: java.lang.IllegalArgumentException: The property [baseDir] marked as required in the configuration definition of [JBossAS7-Standalone] has no attribute 'default'

This will help the developer fix his plugin.

As production will only use plugins that are correct, is not applicable there anyway.

Logging would have been an option, but this way it is more clear that the developer needs to fix his code.


d84b67b on as7plugin branch

Comment 4 Heiko W. Rupp 2011-07-28 14:35:50 UTC
ae90811cb on master