Source:
<code>public Response toolsIndexSearch(String query, MultivaluedMap<String, String> queryParameters, SecurityContext securityContext) { if (!config.getEsConfiguration().getHostname().isEmpty()) { try (RestClient restClient = RestClient .builder(new HttpHost(config.getEsConfiguration().getHostname(), config.getEsConfiguration().getPort(), "http")) .build()) { HttpEntity entity = query == null ? null : new NStringEntity(query, ContentType.APPLICATION_JSON); Map<String, String> parameters = new HashMap<>(); if (queryParameters != null) { queryParameters.forEach((key, value) -> parameters.put(key, value.get(0))); } org.elasticsearch.client.Response get = restClient.performRequest("GET", "/entry/_search", parameters, entity); if (get.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new CustomWebApplicationException("Could not submit index to elastic search", HttpStatus.SC_INTERNAL_SERVER_ERROR); } return Response.ok().entity(get.getEntity().getContent()).build(); } catch (ResponseException e) { int[] codesToResurface = {HttpStatus.SC_BAD_REQUEST}; int statusCode = e.getResponse().getStatusLine().getStatusCode(); if (ArrayUtils.contains(codesToResurface, statusCode)) { throw new CustomWebApplicationException(e.getMessage(), statusCode); } else { throw new CustomWebApplicationException(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); } } catch (IOException e2) { <START> throw new CustomWebApplicationException(e2.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); <END> } } return Response.ok().entity(0).build(); }</code><technical_language>Log exception</technical_language>

Target:
public Response toolsIndexSearch(String query, MultivaluedMap<String, String> queryParameters, SecurityContext securityContext) { if (!config.getEsConfiguration().getHostname().isEmpty()) { try (RestClient restClient = RestClient .builder(new HttpHost(config.getEsConfiguration().getHostname(), config.getEsConfiguration().getPort(), "http")) .build()) { HttpEntity entity = query == null ? null : new NStringEntity(query, ContentType.APPLICATION_JSON); Map<String, String> parameters = new HashMap<>(); if (queryParameters != null) { queryParameters.forEach((key, value) -> parameters.put(key, value.get(0))); } org.elasticsearch.client.Response get = restClient.performRequest("GET", "/entry/_search", parameters, entity); if (get.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new CustomWebApplicationException("Could not submit index to elastic search", HttpStatus.SC_INTERNAL_SERVER_ERROR); } return Response.ok().entity(get.getEntity().getContent()).build(); } catch (ResponseException e) { int[] codesToResurface = {HttpStatus.SC_BAD_REQUEST}; int statusCode = e.getResponse().getStatusLine().getStatusCode(); LOG.error("Could not use Elasticsearch search", e); if (ArrayUtils.contains(codesToResurface, statusCode)) { throw new CustomWebApplicationException(e.getMessage(), statusCode); } else { throw new CustomWebApplicationException(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); } } catch (IOException e2) { LOG.error("Could not use Elasticsearch search", e2); throw new CustomWebApplicationException(e2.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); } } return Response.ok().entity(0).build(); }