Bug 725417 - NPE on plugin update
Summary: NPE on plugin update
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Core Server
Version: 4.1
Hardware: Unspecified
OS: Unspecified
medium
unspecified vote
Target Milestone: ---
: ---
Assignee: Heiko W. Rupp
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-25 12:27 UTC by Heiko W. Rupp
Modified: 2011-10-06 19:48 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-28 18:29:28 UTC


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.