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

Method parseQueryV1

src/tsd/HttpJsonSerializer.java:264–281  ·  view source on GitHub ↗

Parses a timeseries data query @return A TSQuery with data ready to validate @throws JSONException if parsing failed @throws BadRequestException if the content was missing or parsing failed

()

Source from the content-addressed store, hash-verified

262 * @throws BadRequestException if the content was missing or parsing failed
263 */
264 public TSQuery parseQueryV1() {
265 final String json = query.getContent();
266 if (json == null || json.isEmpty()) {
267 throw new BadRequestException(HttpResponseStatus.BAD_REQUEST,
268 "Missing message content",
269 "Supply valid JSON formatted data in the body of your request");
270 }
271 try {
272 TSQuery data_query = JSON.parseToObject(json, TSQuery.class);
273 // Filter out duplicate queries
274 Set<TSSubQuery> query_set = new LinkedHashSet<TSSubQuery>(data_query.getQueries());
275 data_query.getQueries().clear();
276 data_query.getQueries().addAll(query_set);
277 return data_query;
278 } catch (IllegalArgumentException iae) {
279 throw new BadRequestException("Unable to parse the given JSON", iae);
280 }
281 }
282
283 /**
284 * Parses a last data point query

Callers

nothing calls this directly

Calls 5

parseToObjectMethod · 0.95
getQueriesMethod · 0.95
isEmptyMethod · 0.80
clearMethod · 0.80
getContentMethod · 0.45

Tested by

no test coverage detected