Source:
private String getResponse(String url) throws OpenWeatherMapCommunicationException, OpenWeatherMapConfigurationException { try { logger.trace("OpenWeatherMap request: URL = '{}'", url); ContentResponse contentResponse = httpClient.newRequest(url).method(GET).timeout(10, TimeUnit.SECONDS) .send(); int httpStatus = contentResponse.getStatus(); String content = contentResponse.getContentAsString(); String errorMessage = StringUtils.EMPTY; logger.trace("OpenWeatherMap response: status = {}, content = '{}'", httpStatus, content); switch (httpStatus) { case OK_200: return content; case BAD_REQUEST_400: case UNAUTHORIZED_401: errorMessage = getErrorMessage(content); logger.debug("OpenWeatherMap server responded with status code {}: {}", httpStatus, errorMessage); throw new OpenWeatherMapConfigurationException(errorMessage); case TOO_MANY_REQUESTS_429: default: errorMessage = getErrorMessage(content); logger.debug("OpenWeatherMap server responded with status code {}: {}", httpStatus, errorMessage); throw new OpenWeatherMapCommunicationException(errorMessage); } } catch (ExecutionException e) { String errorMessage = e.getLocalizedMessage(); if (errorMessage.startsWith("org.eclipse.jetty.client.HttpResponseException")) { logger.debug("OpenWeatherMap server responded with status code {}: Invalid API key.", UNAUTHORIZED_401); throw new OpenWeatherMapConfigurationException("@text/offline.conf-error-invalid-apikey", e.getCause()); } else { logger.debug("Exception occurred during execution: {}", errorMessage, e); throw new OpenWeatherMapCommunicationException(errorMessage, e.getCause()); } } catch (InterruptedException | TimeoutException e) { logger.debug("Exception occurred during execution: {}", e.getLocalizedMessage(), e); throw new OpenWeatherMapCommunicationException(e.getLocalizedMessage(), e.getCause()); } }

Target:
private String getResponse(String url) { try { if (logger.isTraceEnabled()) { logger.trace("OpenWeatherMap request: URL = '{}'", uglifyApikey(url)); } ContentResponse contentResponse = httpClient.newRequest(url).method(GET).timeout(10, TimeUnit.SECONDS) .send(); int httpStatus = contentResponse.getStatus(); String content = contentResponse.getContentAsString(); String errorMessage = StringUtils.EMPTY; logger.trace("OpenWeatherMap response: status = {}, content = '{}'", httpStatus, content); switch (httpStatus) { case OK_200: return content; case BAD_REQUEST_400: case UNAUTHORIZED_401: case NOT_FOUND_404: errorMessage = getErrorMessage(content); logger.debug("OpenWeatherMap server responded with status code {}: {}", httpStatus, errorMessage); throw new OpenWeatherMapConfigurationException(errorMessage); case TOO_MANY_REQUESTS_429: default: errorMessage = getErrorMessage(content); logger.debug("OpenWeatherMap server responded with status code {}: {}", httpStatus, errorMessage); throw new OpenWeatherMapCommunicationException(errorMessage); } } catch (ExecutionException e) { String errorMessage = e.getLocalizedMessage(); logger.trace("Exception occurred during execution: {}", errorMessage, e); if (e.getCause() instanceof HttpResponseException) { logger.debug("OpenWeatherMap server responded with status code {}: Invalid API key.", UNAUTHORIZED_401); throw new OpenWeatherMapConfigurationException("@text/offline.conf-error-invalid-apikey", e.getCause()); } else { throw new OpenWeatherMapCommunicationException(errorMessage, e.getCause()); } } catch (InterruptedException | TimeoutException e) { logger.debug("Exception occurred during execution: {}", e.getLocalizedMessage(), e); throw new OpenWeatherMapCommunicationException(e.getLocalizedMessage(), e.getCause()); } }