Bug 726172

Summary: potential NPE in LogFileEventResourceComponentHelper.startLogFileEventPollers() if 'enabled' log event source prop is undefined or null
Product: [Other] RHQ Project Reporter: Ian Springer <ian.springer>
Component: Plugin ContainerAssignee: RHQ Project Maintainer <rhq-maint>
Status: NEW --- QA Contact: Mike Foley <mfoley>
Severity: low Docs Contact:
Priority: low    
Version: 4.0.1CC: hbrock, 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: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 678340    

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) {