Source:
public MantaMultipartStatus getStatus(final ServerSideMultipartUpload upload) throws IOException { Validate.notNull(upload, "Upload state object must not be null"); final String partsDirectory; if (upload.getPartsDirectory() == null) { partsDirectory = uuidPrefixedPath(upload.getId()); } else { partsDirectory = upload.getPartsDirectory(); } final String getPath = partsDirectory + SEPARATOR + "state"; final HttpGet get = httpHelper.getRequestFactory().get(getPath); final int expectedStatusCode = HttpStatus.SC_OK; try (CloseableHttpResponse response = httpHelper.getConnectionContext().getHttpClient().execute(get)) { StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_NOT_FOUND) { return MantaMultipartStatus.UNKNOWN; } validateStatusCode(expectedStatusCode, statusLine.getStatusCode(), "Unable to get status for multipart upload", get, response, null, null); validateEntityIsPresent(get, response, null, null); try (InputStream in = response.getEntity().getContent()) { ObjectNode objectNode = MantaObjectMapper.INSTANCE.readValue(in, ObjectNode.class); JsonNode stateNode = objectNode.get("state"); Validate.notNull(stateNode, "Unable to get state from response"); String state = stateNode.textValue(); Validate.notBlank(state, "State field was blank in response"); if (state.equalsIgnoreCase("created")) { return MantaMultipartStatus.CREATED; } if (state.equalsIgnoreCase("finalizing")) { return extractMultipartStatusResult(objectNode); } if (state.equalsIgnoreCase("done")) { return extractMultipartStatusResult(objectNode); } return MantaMultipartStatus.UNKNOWN; } catch (JsonParseException e) { String msg = "Response body was not JSON"; MantaMultipartException me = new MantaMultipartException(msg, e); annotateException(me, get, response, null, null); throw me; } catch (NullPointerException | IllegalArgumentException e) { String msg = "Expected response field was missing or malformed"; MantaMultipartException me = new MantaMultipartException(msg, e); annotateException(me, get, response, null, null); throw me; } } }

Target:
public MantaMultipartStatus getStatus(final ServerSideMultipartUpload upload) throws IOException { Validate.notNull(upload, "Upload state object must not be null"); final String partsDirectory; if (upload.getPartsDirectory() == null) { partsDirectory = uuidPrefixedPath(upload.getId()); } else { partsDirectory = upload.getPartsDirectory(); } final String getPath = partsDirectory + SEPARATOR + "state"; final HttpGet get = httpHelper.getRequestFactory().get(getPath); final int expectedStatusCode = HttpStatus.SC_OK; final CloseableHttpClient httpClient = httpHelper.getConnectionContext().getHttpClient(); try (CloseableHttpResponse response = httpClient.execute(get)) { StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_NOT_FOUND) { return MantaMultipartStatus.UNKNOWN; } validateStatusCode(expectedStatusCode, statusLine.getStatusCode(), "Unable to get status for multipart upload", get, response, null, null); validateEntityIsPresent(get, response, null, null); try (InputStream in = response.getEntity().getContent()) { ObjectNode objectNode = MantaObjectMapper.INSTANCE.readValue(in, ObjectNode.class); JsonNode stateNode = objectNode.get("state"); Validate.notNull(stateNode, "Unable to get state from response"); String state = stateNode.textValue(); Validate.notBlank(state, "State field was blank in response"); if (state.equalsIgnoreCase("created")) { return MantaMultipartStatus.CREATED; } if (state.equalsIgnoreCase("finalizing")) { return extractMultipartStatusResult(objectNode); } if (state.equalsIgnoreCase("done")) { return extractMultipartStatusResult(objectNode); } return MantaMultipartStatus.UNKNOWN; } catch (JsonParseException e) { String msg = "Response body was not JSON"; MantaMultipartException me = new MantaMultipartException(msg, e); annotateException(me, get, response, null, null); throw me; } catch (NullPointerException | IllegalArgumentException e) { String msg = "Expected response field was missing or malformed"; MantaMultipartException me = new MantaMultipartException(msg, e); annotateException(me, get, response, null, null); throw me; } } }