thresholdFilter is ignored if value is null, despite AND condition

Description

If I have a filter like this:

<resource-filter field="oeDbKey">^[a-zA-Z]+$</resource-filter>

The attribute filterOperator has a value of and
The field oeDbKey is null

I would expect the filter to fail.

However, in opennms-services/src/main/java/org/opennms/netmgmt/threshd/ThresholdingSet.java in the method passedThresholdFilters there is only a warning:

} else { LOG.warn("passedThresholdFilters: can't find value of {} for resource {}", f.getField(), resource); }

As a result the filter passes.

I think the warning should be changed like this:

} else { LOG.warn("passedThresholdFilters: can't find value of {} for resource {}", f.getField(), resource); if (operator.equals("and")) return false; }

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Alejandro Galue November 27, 2013 at 3:52 PM

Fixed on revision fee1f0523c2216ec74c298085c670dd5a1722736 for 1.12

Alejandro Galue November 27, 2013 at 2:24 PM

You're correct slightly smiling face

I'm going to apply the suggested fix.

Jan Keirse November 26, 2013 at 11:10 AM

Notice that if the filterOperator is or it will already behave the way I want it to behave (if only one filter is present) so the behaviour I suggest is probably correct.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

PagerDuty

Created November 26, 2013 at 10:43 AM
Updated January 27, 2017 at 4:21 PM
Resolved November 27, 2013 at 3:52 PM

Flag notifications