Source:
<code>protected void processQuery() { Integer recCount = null; try { asyncQueryDao.updateStatus(queryObj, QueryStatus.PROCESSING); ElideResponse response = null; log.debug("AsyncQuery Object from request: {}", queryObj); if (queryObj.getQueryType().equals(QueryType.JSONAPI_V1_0)) { MultivaluedMap<String, String> queryParams = getQueryParams(queryObj.getQuery()); log.debug("Extracted QueryParams from AsyncQuery Object: {}", queryParams); response = elide.get(getPath(queryObj.getQuery()), queryParams, user, apiVersion); log.debug("JSONAPI_V1_0 getResponseCode: {}, JSONAPI_V1_0 getBody: {}", response.getResponseCode(), response.getBody()); <START> if (isValidJSON(response.getBody())) { <END> recCount = calculateRecordsJSON(response.getBody()); } } else if (queryObj.getQueryType().equals(QueryType.GRAPHQL_V1_0)) { response = runner.run(queryObj.getQuery(), user); log.debug("GRAPHQL_V1_0 getResponseCode: {}, GRAPHQL_V1_0 getBody: {}", response.getResponseCode(), response.getBody()); if (isValidJSON(response.getBody())) { recCount = calculateRecordsGRAPHQL(response.getBody()); } } if (response == null) { throw new NoHttpResponseException("Response for request returned as null"); } AsyncQueryResult asyncQueryResult = new AsyncQueryResult(); asyncQueryResult.setHttpStatus(response.getResponseCode()); asyncQueryResult.setResponseBody(response.getBody()); asyncQueryResult.setContentLength(response.getBody().length()); asyncQueryResult.setRecordCount(recCount); asyncQueryResult.setResultType(ResultType.EMBEDDED); asyncQueryResult.setCompletedOn(new Date()); asyncQueryDao.updateAsyncQueryResult(asyncQueryResult, queryObj); asyncQueryDao.updateStatus(queryObj, QueryStatus.COMPLETE); } catch (Exception e) { log.error("Exception: {}", e); if (e.getClass().equals(InterruptedException.class)) { asyncQueryDao.updateStatus(queryObj, QueryStatus.TIMEDOUT); } else { asyncQueryDao.updateStatus(queryObj, QueryStatus.FAILURE); } } }</code><technical_language>isValidJson check done calculateRecordsJSON</technical_language>

Target:
protected void processQuery() { Integer recCount = null; try { asyncQueryDao.updateStatus(queryObj, QueryStatus.PROCESSING); ElideResponse response = null; log.debug("AsyncQuery Object from request: {}", queryObj); if (queryObj.getQueryType().equals(QueryType.JSONAPI_V1_0)) { MultivaluedMap<String, String> queryParams = getQueryParams(queryObj.getQuery()); log.debug("Extracted QueryParams from AsyncQuery Object: {}", queryParams); response = elide.get(getPath(queryObj.getQuery()), queryParams, user, apiVersion); log.debug("JSONAPI_V1_0 getResponseCode: {}, JSONAPI_V1_0 getBody: {}", response.getResponseCode(), response.getBody()); if (response.getResponseCode() == 200) { recCount = calculateRecordsJSON(response.getBody()); } } else if (queryObj.getQueryType().equals(QueryType.GRAPHQL_V1_0)) { response = runner.run(queryObj.getQuery(), user); log.debug("GRAPHQL_V1_0 getResponseCode: {}, GRAPHQL_V1_0 getBody: {}", response.getResponseCode(), response.getBody()); if (response.getResponseCode() == 200) { String tableName = getTableNameFromQuery(queryObj.getQuery()); recCount = calculateRecordsGRAPHQL(response.getBody(), tableName); } } if (response == null) { throw new NoHttpResponseException("Response for request returned as null"); } AsyncQueryResult asyncQueryResult = new AsyncQueryResult(); asyncQueryResult.setHttpStatus(response.getResponseCode()); asyncQueryResult.setResponseBody(response.getBody()); asyncQueryResult.setContentLength(response.getBody().length()); asyncQueryResult.setRecordCount(recCount); asyncQueryResult.setResultType(ResultType.EMBEDDED); asyncQueryResult.setCompletedOn(new Date()); asyncQueryDao.updateAsyncQueryResult(asyncQueryResult, queryObj); asyncQueryDao.updateStatus(queryObj, QueryStatus.COMPLETE); } catch (Exception e) { log.error("Exception: {}", e); if (e.getClass().equals(InterruptedException.class)) { asyncQueryDao.updateStatus(queryObj, QueryStatus.TIMEDOUT); } else { asyncQueryDao.updateStatus(queryObj, QueryStatus.FAILURE); } } }