Source:
private Void deserializeAndUpdateContent(HttpServletRequest req, HttpServletResponse resp, boolean merge) { Maybe<ApplicationConfiguration> possibleConfig; try { possibleConfig = appConfigFetcher.configurationFor(req); } catch (ApiKeyNotFoundException | RevokedApiKeyException | InvalidIpForApiKeyException ex) { return error(resp, HttpStatusCode.FORBIDDEN.code()); } if (possibleConfig.isNothing()) { return error(resp, HttpStatus.UNAUTHORIZED.value()); } Content content; try { content = complexify(deserialize(new InputStreamReader(req.getInputStream()))); } catch (IOException ioe) { log.error("Error reading input for request " + req.getRequestURL(), ioe); return error(resp, HttpStatusCode.SERVER_ERROR.code()); } catch (Exception e) { log.error("Error reading input for request " + req.getRequestURL(), e); return error(resp, HttpStatusCode.BAD_REQUEST.code()); } if (!possibleConfig.requireValue().canWrite(content.getPublisher())) { return error(resp, HttpStatusCode.FORBIDDEN.code()); } if (Strings.isNullOrEmpty(content.getCanonicalUri())) { return error(resp, HttpStatusCode.BAD_REQUEST.code()); } content = updateEventPublisher(content); try { content = merge(resolveExisting(content), content, merge); if (content instanceof Item) { Item item = (Item) content; writer.createOrUpdate(item); updateSchedule(item); } else { writer.createOrUpdate((Container) content); } } catch (Exception e) { log.error("Error reading input for request " + req.getRequestURL(), e); return error(resp, HttpStatusCode.SERVER_ERROR.code()); } String hostName = Configurer.get("local.host.name").get(); resp.setHeader( HttpHeaders.LOCATION, hostName + "/3.0/content.json?id=" + codec.encode(BigInteger.valueOf(content.getId())) ); resp.setStatus(HttpStatusCode.OK.code()); resp.setContentLength(0); return null; }

Target:
private Void deserializeAndUpdateContent(HttpServletRequest req, HttpServletResponse resp, boolean merge) { Maybe<ApplicationConfiguration> possibleConfig; try { possibleConfig = appConfigFetcher.configurationFor(req); } catch (ApiKeyNotFoundException | RevokedApiKeyException | InvalidIpForApiKeyException ex) { return error(resp, HttpStatusCode.FORBIDDEN.code()); } if (possibleConfig.isNothing()) { return error(resp, HttpStatus.UNAUTHORIZED.value()); } Content content; try { content = complexify(deserialize(new InputStreamReader(req.getInputStream()))); } catch (IOException ioe) { log.error("Error reading input for request " + req.getRequestURL(), ioe); return error(resp, HttpStatusCode.SERVER_ERROR.code()); } catch (Exception e) { log.error("Error reading input for request " + req.getRequestURL(), e); return error(resp, HttpStatusCode.BAD_REQUEST.code()); } if (!possibleConfig.requireValue().canWrite(content.getPublisher())) { return error(resp, HttpStatusCode.FORBIDDEN.code()); } if (Strings.isNullOrEmpty(content.getCanonicalUri())) { return error(resp, HttpStatusCode.BAD_REQUEST.code()); } try { content = merge(resolveExisting(content), content, merge); if (content instanceof Item) { Item item = (Item) content; writer.createOrUpdate(item); updateSchedule(item); } else { writer.createOrUpdate((Container) content); } } catch (Exception e) { log.error("Error reading input for request " + req.getRequestURL(), e); return error(resp, HttpStatusCode.SERVER_ERROR.code()); } String hostName = Configurer.get("local.host.name").get(); resp.setHeader( HttpHeaders.LOCATION, hostName + "/3.0/content.json?id=" + codec.encode(BigInteger.valueOf(content.getId())) ); resp.setStatus(HttpStatusCode.OK.code()); resp.setContentLength(0); return null; }