Source:
<code>public void complete(final ServerSideMultipartUpload upload, final Stream<? extends MantaMultipartUploadTuple> partsStream) throws IOException { Validate.notNull(upload, "Upload state object must not be null"); final String path = upload.getPath(); final String postPath = upload.getPartsDirectory(); final HttpPost post = httpHelper.getRequestFactory().post(postPath + "/commit"); final byte[] jsonRequest; final int numParts; try { ImmutablePair<byte[], Integer> pair = createCommitRequestBody(partsStream); jsonRequest = pair.getLeft(); numParts = pair.getRight(); } catch (NullPointerException | IllegalArgumentException e) { String msg = "Expected response field was missing or malformed"; MantaMultipartException me = new MantaMultipartException(msg, e); annotateException(me, post, null, path, null); throw me; } final HttpEntity entity = new ExposedByteArrayEntity( jsonRequest, ContentType.APPLICATION_JSON); post.setEntity(entity); final int expectedStatusCode = HttpStatus.SC_CREATED; <START> try (CloseableHttpResponse response = httpHelper.getConnectionContext().getHttpClient().execute(post)) { <END> StatusLine statusLine = response.getStatusLine(); validateStatusCode(expectedStatusCode, statusLine.getStatusCode(), "Unable to create multipart upload", post, response, path, jsonRequest); Header location = response.getFirstHeader(HttpHeaders.LOCATION); if (location != null && LOGGER.isInfoEnabled()) { LOGGER.info("Multipart upload for file from parts has completed", upload.getId(), location.getValue(), numParts); } } catch (MantaMultipartException | MantaClientHttpResponseException me) { throw me; } catch (Exception e) { String msg = "Error initiating multipart upload completion"; MantaMultipartException me = new MantaMultipartException(msg, e); annotateException(me, post, null, path, jsonRequest); throw me; } }</code><technical_language>Potentially break context client out a separate variable</technical_language>

Target:
public void complete(final ServerSideMultipartUpload upload, final Stream<? extends MantaMultipartUploadTuple> partsStream) throws IOException { Validate.notNull(upload, "Upload state object must not be null"); final String path = upload.getPath(); final String postPath = upload.getPartsDirectory(); final HttpPost post = httpHelper.getRequestFactory().post(postPath + "/commit"); final byte[] jsonRequest; final int numParts; try { ImmutablePair<byte[], Integer> pair = createCommitRequestBody(partsStream); jsonRequest = pair.getLeft(); numParts = pair.getRight(); } catch (NullPointerException | IllegalArgumentException e) { String msg = "Expected response field was missing or malformed"; MantaMultipartException me = new MantaMultipartException(msg, e); annotateException(me, post, null, path, null); throw me; } final HttpEntity entity = new ExposedByteArrayEntity( jsonRequest, ContentType.APPLICATION_JSON); post.setEntity(entity); final int expectedStatusCode = HttpStatus.SC_CREATED; final CloseableHttpClient httpClient = httpHelper.getConnectionContext().getHttpClient(); try (CloseableHttpResponse response = httpClient.execute(post)) { StatusLine statusLine = response.getStatusLine(); validateStatusCode(expectedStatusCode, statusLine.getStatusCode(), "Unable to create multipart upload", post, response, path, jsonRequest); Header location = response.getFirstHeader(HttpHeaders.LOCATION); if (location != null && LOGGER.isInfoEnabled()) { LOGGER.info("Multipart upload for file from parts has completed", upload.getId(), location.getValue(), numParts); } } catch (MantaMultipartException | MantaClientHttpResponseException me) { throw me; } catch (Exception e) { String msg = "Error initiating multipart upload completion"; MantaMultipartException me = new MantaMultipartException(msg, e); annotateException(me, post, null, path, jsonRequest); throw me; } }