MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / validateFilters

Method validateFilters

src/query/pojo/Query.java:178–197  ·  view source on GitHub ↗

Validates the filters, making sure each metric has a filter @throws IllegalArgumentException if one or more parameters were invalid

()

Source from the content-addressed store, hash-verified

176 * @throws IllegalArgumentException if one or more parameters were invalid
177 */
178 private void validateFilters() {
179 if (filters == null) {
180 return;
181 }
182
183 Set<String> ids = new HashSet<String>();
184 for (Filter filter : filters) {
185 ids.add(filter.getId());
186 }
187
188 for(Metric metric : metrics) {
189 if (metric.getFilter() != null &&
190 !metric.getFilter().isEmpty() &&
191 !ids.contains(metric.getFilter())) {
192 throw new IllegalArgumentException(
193 String.format("unrecognized filter id %s in metric %s",
194 metric.getFilter(), metric.getId()));
195 }
196 }
197 }
198
199 /**
200 * Makes sure the ID has only letters and characters

Callers 1

validateMethod · 0.95

Calls 5

isEmptyMethod · 0.80
containsMethod · 0.80
getIdMethod · 0.65
addMethod · 0.45
getFilterMethod · 0.45

Tested by

no test coverage detected