Source:
<code>protected boolean passedThresholdFilters(CollectionResourceWrapper resource, ThresholdEntity thresholdEntity) { ResourceFilter[] filters = thresholdEntity.getThresholdConfig().getBasethresholddef().getResourceFilter(); if (filters.length == 0) { <START> LOG.info("passedThresholdFilters: No filters found for threshold {}", thresholdEntity.toString()); <END> return true; } String operator = thresholdEntity.getThresholdConfig().getBasethresholddef().getFilterOperator().toLowerCase(); LOG.debug("passedThresholdFilters: applying filters to resource with logical connection operator '{}'", filters.length, resource, operator); int count = 0; boolean result = true; for (ResourceFilter f : filters) { count++; LOG.debug("passedThresholdFilters: filter #{}: field={}, regex='{}'", count, f.getField(), f.getContent()); String attr = resource.getFieldValue(f.getField()); if (attr != null) { try { final Pattern p = Pattern.compile(f.getContent()); final Matcher m = p.matcher(attr); boolean pass = m.matches(); LOG.debug("passedThresholdFilters: the value of is {}. Pass filter? {}", f.getField(), attr, pass); if (operator.equals("or") && pass) { LOG.debug("passedThresholdFilters: Filter #{} passed and logical connection operator is 'or', no need to apply other filters", count); break; } if (operator.equals("and")) { result = result && pass; if (result == false) { LOG.debug("passedThresholdFilters: Filter #{} didn't pass and logical connection operator is 'and', no need to apply other filters", count); break; } } } catch (PatternSyntaxException e) { LOG.warn("passedThresholdFilters: the regular expression is invalid: {}", f.getContent(), e.getMessage(), e); return false; } } else { LOG.warn("passedThresholdFilters: can't find value of for resource {}", f.getField(), resource); if (operator.equals("and")) { return false; } } } if (result) { LOG.info("passedThresholdFilters: Resource passed threshold filters", resource); return true; } else { LOG.info("passedThresholdFilters: Resource didn't pass threshold filters", resource); return false; } }</code><technical_language>need for .toString() here</technical_language>

Target:
protected boolean passedThresholdFilters(CollectionResourceWrapper resource, ThresholdEntity thresholdEntity) { ResourceFilter[] filters = thresholdEntity.getThresholdConfig().getBasethresholddef().getResourceFilter(); if (filters.length == 0) { LOG.info("passedThresholdFilters: No filters found for threshold {}", thresholdEntity); return true; } String operator = thresholdEntity.getThresholdConfig().getBasethresholddef().getFilterOperator().toLowerCase(); LOG.debug("passedThresholdFilters: applying filters to resource with logical connection operator '{}'", filters.length, resource, operator); int count = 0; boolean result = true; for (ResourceFilter f : filters) { count++; LOG.debug("passedThresholdFilters: filter #{}: field={}, regex='{}'", count, f.getField(), f.getContent()); String attr = resource.getFieldValue(f.getField()); if (attr != null) { try { final Pattern p = Pattern.compile(f.getContent()); final Matcher m = p.matcher(attr); boolean pass = m.matches(); LOG.debug("passedThresholdFilters: the value of is {}. Pass filter? {}", f.getField(), attr, pass); if (operator.equals("or") && pass) { LOG.debug("passedThresholdFilters: Filter #{} passed and logical connection operator is 'or', no need to apply other filters", count); break; } if (operator.equals("and")) { result = result && pass; if (result == false) { LOG.debug("passedThresholdFilters: Filter #{} didn't pass and logical connection operator is 'and', no need to apply other filters", count); break; } } } catch (PatternSyntaxException e) { LOG.warn("passedThresholdFilters: the regular expression is invalid: {}", f.getContent(), e.getMessage(), e); return false; } } else { LOG.warn("passedThresholdFilters: can't find value of for resource {}", f.getField(), resource); if (operator.equals("and")) { return false; } } } if (result) { LOG.info("passedThresholdFilters: Resource passed threshold filters", resource); return true; } else { LOG.info("passedThresholdFilters: Resource didn't pass threshold filters", resource); return false; } }