Source:
public FetchResponse(HttpResponse r, RiakClient riak) throws RiakResponseRuntimeException, RiakIORuntimeException { super(r); if (r == null) return; Map<String, String> headers = r.getHttpHeaders(); List<RiakLink> links = ClientUtils.parseLinkHeader(headers.get(Constants.HDR_LINK)); @SuppressWarnings("rawtypes") List<RiakIndex> indexes = ClientUtils.parseIndexHeaders(headers); Map<String, String> usermeta = ClientUtils.parseUsermeta(headers); vclock = headers.get(Constants.HDR_VCLOCK); if (r.getStatusCode() == 300) { String contentType = headers.get(Constants.HDR_CONTENT_TYPE); if (contentType == null || !(contentType.trim().toLowerCase().startsWith(Constants.CTYPE_MULTIPART_MIXED))) { throw new RiakResponseRuntimeException(r, "multipart/mixed content expected when object has siblings"); } if (r.isStreamed()) { try { StreamedMultipart multipart = new StreamedMultipart(headers, r.getStream()); siblings = new StreamedSiblingsCollection(riak, r.getBucket(), r.getKey(), multipart); } catch (IOException e) { throw new RiakIORuntimeException("Error finding initial boundary", e); } } else { siblings = ClientUtils.parseMultipart(riak, r.getBucket(), r.getKey(), headers, r.getBody()); } object = siblings.iterator().next(); } else if (r.getStatusCode() == 400) { throw new RiakResponseRuntimeException(r, r.getBodyAsString()); } else if (r.isSuccess()) { object = new RiakObject(riak, r.getBucket(), r.getKey(), r.getBody(), headers.get(Constants.HDR_CONTENT_TYPE), links, usermeta, headers.get(Constants.HDR_VCLOCK), headers.get(Constants.HDR_LAST_MODIFIED), headers.get(Constants.HDR_ETAG), indexes); Long contentLength = null; try { contentLength = Long.parseLong(headers .get(Constants.HDR_CONTENT_LENGTH)); } catch (NumberFormatException ignored) object.setValueStream(r.getStream(), contentLength); } }

Target:
public FetchResponse(HttpResponse r, RiakClient riak) throws RiakResponseRuntimeException, RiakIORuntimeException { super(r); if (r == null) return; Map<String, String> headers = r.getHttpHeaders(); List<RiakLink> links = ClientUtils.parseLinkHeader(headers.get(Constants.HDR_LINK)); @SuppressWarnings("rawtypes") List<RiakIndex> indexes = ClientUtils.parseIndexHeaders(headers); Map<String, String> usermeta = ClientUtils.parseUsermeta(headers); vclock = headers.get(Constants.HDR_VCLOCK); if (r.getStatusCode() == 300) { String contentType = headers.get(Constants.HDR_CONTENT_TYPE); if (contentType == null || !(contentType.trim().toLowerCase().startsWith(Constants.CTYPE_MULTIPART_MIXED))) { throw new RiakResponseRuntimeException(r, "multipart/mixed content expected when object has siblings"); } if (r.isStreamed()) { try { StreamedMultipart multipart = new StreamedMultipart(headers, r.getStream()); siblings = new StreamedSiblingsCollection(riak, r.getBucket(), r.getKey(), multipart); } catch (IOException e) { throw new RiakIORuntimeException("Error finding initial boundary", e); } } else { siblings = ClientUtils.parseMultipart(riak, r.getBucket(), r.getKey(), headers, r.getBody()); } object = siblings.iterator().next(); } else if (r.isSuccess()) { object = new RiakObject(riak, r.getBucket(), r.getKey(), r.getBody(), headers.get(Constants.HDR_CONTENT_TYPE), links, usermeta, headers.get(Constants.HDR_VCLOCK), headers.get(Constants.HDR_LAST_MODIFIED), headers.get(Constants.HDR_ETAG), indexes); Long contentLength = null; try { contentLength = Long.parseLong(headers .get(Constants.HDR_CONTENT_LENGTH)); } catch (NumberFormatException ignored) object.setValueStream(r.getStream(), contentLength); } else if (r.isError() && (r.getStatusCode() != 404) && (r.getStatusCode() != 412)) { throw new RiakResponseRuntimeException(r, r.getBodyAsString()); } }