Source:
<code>public P provide() { final ContainerRequest request = getRequestProvider().get(); final UriInfo uriInfo = request.getUriInfo(); final URI requestUri = uriInfo.getRequestUri(); final MultivaluedMap<? super String, ? extends String> queryParameters = uriInfo .getQueryParameters(); String apiKeyName = getAuthenticator().getApiKeyName(); final List<? extends String> apiKeys = queryParameters.get(apiKeyName); if (apiKeys == null || apiKeys.isEmpty()) { throw new BadRequestException("apiKey is required in param: " + apiKeyName); } final CredentialsBuilder builder = builder(); builder.withApiKey(!apiKeys.isEmpty() ? apiKeys.get(0) : null); builder.withSignature(request.getHeaderString("X-Auth-Signature")); builder.withTimestamp(request.getHeaderString("X-Auth-Timestamp")); builder.withVersion( Version.fromValue(request.getHeaderString("X-Auth-Version"))); builder.withMethod(request.getMethod()); builder.withPath(requestUri.getPath() + "?" + requestUri.getQuery()); if (request.hasEntity()) { try { final InputStream inputStream = request.getEntityStream(); try { final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); copy(inputStream, outputStream); final byte[] bytes = outputStream.toByteArray(); builder.withContent(bytes); request.setEntityStream(new ByteArrayInputStream(bytes)); } finally { inputStream.close(); } } catch (final IOException ioe) { <START> logger.error(ioe.getMessage(), ioe); <END> throw new InternalServerErrorException("Error reading content"); } } final P retval = getAuthenticator().authenticate(builder.build()); if (retval == null) { throw new NotAuthorizedException(status(UNAUTHORIZED).build()); } return retval; }</code><technical_language>Do log throwing exception below</technical_language>

Target:
public P provide() { final ContainerRequest request = getRequestProvider().get(); final UriInfo uriInfo = request.getUriInfo(); final URI requestUri = uriInfo.getRequestUri(); final MultivaluedMap<? super String, ? extends String> queryParameters = uriInfo .getQueryParameters(); String apiKeyName = getAuthenticator().getApiKeyName(); final List<? extends String> apiKeys = queryParameters.get(apiKeyName); if (apiKeys == null || apiKeys.isEmpty()) { throw new BadRequestException("apiKey is required in param: " + apiKeyName); } final CredentialsBuilder builder = Credentials.builder(); builder.withApiKey(!apiKeys.isEmpty() ? apiKeys.get(0) : null); builder.withSignature(request.getHeaderString("X-Auth-Signature")); builder.withTimestamp(request.getHeaderString("X-Auth-Timestamp")); builder.withVersion( Version.fromValue(request.getHeaderString("X-Auth-Version"))); builder.withMethod(request.getMethod()); builder.withPath(requestUri.getPath() + "?" + requestUri.getQuery()); if (request.hasEntity()) { try { final InputStream inputStream = request.getEntityStream(); try { final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteStreams.copy(inputStream, outputStream); final byte[] bytes = outputStream.toByteArray(); builder.withContent(bytes); request.setEntityStream(new ByteArrayInputStream(bytes)); } finally { inputStream.close(); } } catch (final IOException ioe) { throw new InternalServerErrorException("Error reading content", ioe); } } final P retval = getAuthenticator().authenticate(builder.build()); if (retval == null) { throw new NotAuthorizedException(Response.status(Response.Status.UNAUTHORIZED).build()); } return retval; }