Bug 726172 - potential NPE in LogFileEventResourceComponentHelper.startLogFileEventPollers() if 'enabled' log event source prop is undefined or null
potential NPE in LogFileEventResourceComponentHelper.startLogFileEventPollers...
Status: NEW
Product: RHQ Project
Classification: Other
Component: Plugin Container (Show other bugs)
4.0.1
Unspecified Unspecified
low Severity low (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
Mike Foley
:
Depends On:
Blocks: jon3
  Show dependency treegraph
 
Reported: 2011-07-27 14:04 EDT by Ian Springer
Modified: 2015-02-01 18:29 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ian Springer 2011-07-27 14:04:52 EDT
Here's the offending lines:

Boolean enabled = Boolean.valueOf(logEventSource.getSimpleValue(LogEventSourcePropertyNames.ENABLED, null));
            if (enabled) {

The NPE could occur at the if-check if a plugin set the 'enabled' prop to null or did not initialize it at all. 

The code should be changed to:

Boolean enabled = Boolean.valueOf(logEventSource.getSimpleValue(LogEventSourcePropertyNames.ENABLED, null));
            if (enabled == null) {
               String logFilePath =  logEventSource.getSimpleValue(LogEventSourcePropertyNames.LOG_FILE_PATH, null);
               log.warn("Plugin error: 'enabled' property is null for event source for log file [" + logFilePath + "] - this property is required and should always be set. Assuming the event source is disabled...");
                enabled = Boolean.FALSE;
            }
            if (enabled) {

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