Bug 1058534 - Alert template for Trait Change from older RHQ results in NullPointerException
Summary: Alert template for Trait Change from older RHQ results in NullPointerException
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Alerts
Version: 4.9
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: RHQ 4.10
Assignee: Jay Shaughnessy
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-28 01:37 UTC by Elias Ross
Modified: 2014-04-23 12:29 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-04-23 12:29:52 UTC
Embargoed:


Attachments (Terms of Use)

Description Elias Ross 2014-01-28 01:37:12 UTC
Description of problem:

Seen in logs:

23:45:40,649 ERROR [org.rhq.enterprise.server.alert.engine.internal.AlertConditionCacheCoordinator] (http-/0.0.0.0:7080-1003) Error during measurement data cache processing for agent[id=14231]: java.lang.NullPointerException
	at org.rhq.enterprise.server.alert.engine.model.StringCacheElement.matches(StringCacheElement.java:64) [rhq-server.jar:4.9.0]
	at org.rhq.enterprise.server.alert.engine.model.StringCacheElement.matches(StringCacheElement.java:32) [rhq-server.jar:4.9.0]
	at org.rhq.enterprise.server.alert.engine.model.AbstractCacheElement.process(AbstractCacheElement.java:134) [rhq-server.jar:4.9.0]
	at org.rhq.enterprise.server.alert.engine.internal.AbstractConditionCache.processCacheElements(AbstractConditionCache.java:57) [rhq-server.jar:4.9.0]
	at org.rhq.enterprise.server.alert.engine.internal.AgentConditionCache.checkConditions(AgentConditionCache.java:394) [rhq-server.jar:4.9.0]
	at org.rhq.enterprise.server.alert.engine.internal.AlertConditionCacheCoordinator.checkConditions(AlertConditionCacheCoordinator.java:211) [rhq-server.jar:4.9.0]
	at org.rhq.enterprise.server.alert.engine.AlertConditionCacheManagerBean.checkConditions(AlertConditionCacheManagerBean.java:59) [rhq-server.jar:4.9.0]
... 65 lines omitted ...
	at org.rhq.enterprise.server.alert.engine.AlertConditionCacheManagerLocal$$$view152.checkConditions(Unknown Source) [rhq-server.jar:4.9.0]



public abstract class StringCacheElement extends AbstractCacheElement<String> {
...
        // changes requires a slightly
        if (alertConditionOperator == AlertConditionOperator.CHANGES) {
            Boolean results = null;

            if ((results == null) && (alertConditionValue.equals(providedValue) == false)) {

^^^^ alertConditionValue is null here I guess




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


How reproducible: ?


Steps to Reproduce: (likely)
1. For an older version of RHQ not supporting regexes, create a template alert for a change of a trait
2. This is on Oracle, where empty strings are treated as nulls


Actual results: NullPointerException


Expected results: It works :-)


Additional info: Not sure if this a data migration issue or not.

Comment 1 Elias Ross 2014-01-28 16:44:45 UTC
Actually I'm not really sure the ways to reproduce this issue. It seems to have gone away, so I wonder if there is a race condition someplace.

I was observing the following, however.

1) Resource alert definitions created on RHQ 4.5.1 for metric trait change
2) Server updated to 4.9
3) New resources created on 4.9 server/agent. Alert definitions were not copied to these resources. Other alerts were.

I'm not sure this is related or not.

Comment 2 Heiko W. Rupp 2014-02-28 13:10:35 UTC
That line with the NPE looks fishy by itself anyway

 Boolean results = null;
 if ((results == null) && (alertConditionValue.equals(providedValue) == false)) {

So results is always null and the 1st check makes no sense here.
In other CacheElements like the numeric ones, we indeed check for alertConditionValue being null when matches() is called, so there is a possibility that this is the issue here as well.

Comment 3 Jay Shaughnessy 2014-03-07 18:47:46 UTC
master commit ef19f80122c9f53ba953a8b51030db2e4ae56c27
Author: Jay Shaughnessy <jshaughn>
Date:   Fri Mar 7 13:34:39 2014 -0500

The "Changes" operator requires slightly different logic as alertConditionValue
allows null. Add null handling, also refactor some similarly verbose/confusing code in a few CacheElement classes. And add i-test for this issue.

Comment 4 Heiko W. Rupp 2014-04-23 12:29:52 UTC
Bulk closing of 4.10 issues.

If an issue is not solved for you, please open a new BZ (or clone the existing one) with a version designator of 4.10.


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