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.
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.
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.
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.
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.