Source:
public Response updateDocument( @PathParam("id") String id, @Context HttpHeaders headers, @Context HttpServletRequest httpRequest, MultipartBody multipartBody, @QueryParam("transform") String transformerParam, InputStream message) { LOGGER.trace("PUT"); Response response; try { if (id != null && message != null) { MimeType mimeType = getMimeType(headers); CreateInfo createInfo = null; if (multipartBody != null) { List<Attachment> contentParts = multipartBody.getAllAttachments(); if (CollectionUtils.isNotEmpty(contentParts)) { createInfo = parseAttachments(contentParts, transformerParam); } else { LOGGER.debug("No file contents attachment found"); } } if (createInfo == null) { UpdateRequest updateRequest = new UpdateRequestImpl( id, getTransform() .transform( mimeType, new SingleIdSupplier(id), message, transformerParam, Collections.emptyMap()) .get(0)); catalogFramework.update(updateRequest); } else { UpdateStorageRequest streamUpdateRequest = new UpdateStorageRequestImpl( Collections.singletonList( new IncomingContentItem( id, createInfo.getStream(), createInfo.getContentType(), createInfo.getFilename(), 0, createInfo.getMetacard())), null); catalogFramework.update(streamUpdateRequest); } LOGGER.debug("Metacard updated.", id); response = Response.ok().build(); } else { String errorResponseString = "Both ID and content are needed to perform UPDATE."; LOGGER.info(errorResponseString); return createBadRequestResponse(errorResponseString); } } catch (SourceUnavailableException e) { String exceptionMessage = "Cannot update catalog entry: Source is unavailable: "; LOGGER.info(exceptionMessage, e); throw new InternalServerErrorException(exceptionMessage); } catch (InternalIngestException e) { String exceptionMessage = "Error cataloging updated metadata: "; LOGGER.info(exceptionMessage, e); throw new InternalServerErrorException(exceptionMessage); } catch (MetacardCreationException | IngestException e) { String errorMessage = "Error cataloging updated metadata: "; LOGGER.info(errorMessage, e); return createBadRequestResponse(errorMessage); } return response; }

Target:
public Response updateDocument( @PathParam("id") String id, @Context HttpHeaders headers, @Context HttpServletRequest httpRequest, MultipartBody multipartBody, @QueryParam("transform") String transformerParam, InputStream message) { LOGGER.trace("PUT"); Response response; try { if (id != null && message != null) { MimeType mimeType = getMimeType(headers); CreateInfo createInfo = null; if (multipartBody != null) { List<Attachment> contentParts = multipartBody.getAllAttachments(); if (CollectionUtils.isNotEmpty(contentParts)) { createInfo = parseAttachments(contentParts, transformerParam); } else { LOGGER.debug("No file contents attachment found"); } } if (createInfo == null) { TransformResponse transformResponse = getTransform() .transform(mimeType, id, null, message, transformerParam, Collections.emptyMap()); if (!transformResponse.getParentMetacard().isPresent()) { throw new MetacardCreationException("Unable to transform message into a metacard."); } UpdateRequest updateRequest = new UpdateRequestImpl(id, transformResponse.getParentMetacard().get()); catalogFramework.update(updateRequest); } else { UpdateStorageRequest streamUpdateRequest = new UpdateStorageRequestImpl( Collections.singletonList( new IncomingContentItem( id, createInfo.getStream(), createInfo.getContentType(), createInfo.getFilename(), 0, createInfo.getMetacard())), null); catalogFramework.update(streamUpdateRequest); } LOGGER.debug("Metacard updated.", id); response = Response.ok().build(); } else { String errorResponseString = "Both ID and content are needed to perform UPDATE."; LOGGER.info(errorResponseString); return createBadRequestResponse(errorResponseString); } } catch (SourceUnavailableException e) { String exceptionMessage = "Cannot update catalog entry: Source is unavailable: "; LOGGER.info(exceptionMessage, e); throw new InternalServerErrorException(exceptionMessage); } catch (InternalIngestException e) { String exceptionMessage = "Error cataloging updated metadata: "; LOGGER.info(exceptionMessage, e); throw new InternalServerErrorException(exceptionMessage); } catch (MetacardCreationException | IngestException e) { String errorMessage = "Error cataloging updated metadata: "; LOGGER.info(errorMessage, e); return createBadRequestResponse(errorMessage); } return response; }