Source:
private Void deserializeAndUpdatePerson(HttpServletRequest req, HttpServletResponse resp, boolean merge) { Maybe<ApplicationConfiguration> possibleConfig; try { possibleConfig = appConfigFetcher.configurationFor(req); } catch (ApiKeyNotFoundException | RevokedApiKeyException | InvalidIpForApiKeyException e) { log.error("Problem with API key for request " + req.getRequestURL(), e); return error(req, resp, AtlasErrorSummary.forException(e)); } if (possibleConfig.isNothing()) { return error( req, resp, AtlasErrorSummary.forException(new UnauthorizedException( "API key is unauthorised")) ); } Person person; try { person = complexify(deserialize(new InputStreamReader(req.getInputStream()))); } catch (UnrecognizedPropertyException | JsonParseException | ConstraintViolationException exception) { return error(req, resp, AtlasErrorSummary.forException(exception)); } catch (IOException ioe) { log.error("Error reading input for request " + req.getRequestURL(), ioe); return error(req, resp, AtlasErrorSummary.forException(ioe)); } catch (Exception e) { log.error("Error reading input for request " + req.getRequestURL(), e); AtlasErrorSummary errorSummary = new AtlasErrorSummary(e) .withMessage("Error reading input for the request") .withStatusCode(HttpStatusCode.BAD_REQUEST); return error(req, resp, errorSummary); } if (!possibleConfig.requireValue().canWrite(person.getPublisher())) { return error( req, resp, AtlasErrorSummary.forException(new ForbiddenException( "API key does not have write permission")) ); } try { person = merge(resolveExisting(person), person, merge); store.createOrUpdatePerson(person); } catch (Exception e) { log.error("Error reading input for request " + req.getRequestURL(), e); AtlasErrorSummary errorSummary = new AtlasErrorSummary(e) .withStatusCode(HttpStatusCode.BAD_REQUEST); return error(req, resp, errorSummary); } resp.setStatus(HttpStatusCode.OK.code()); resp.setContentLength(0); return null; }

Target:
private Void deserializeAndUpdatePerson(HttpServletRequest req, HttpServletResponse resp, boolean merge) { Maybe<ApplicationConfiguration> possibleConfig; try { possibleConfig = appConfigFetcher.configurationFor(req); } catch (ApiKeyNotFoundException | RevokedApiKeyException | InvalidIpForApiKeyException e) { log.error("Problem with API key for request " + req.getRequestURL(), e); return error(req, resp, AtlasErrorSummary.forException(e)); } if (possibleConfig.isNothing()) { return error( req, resp, AtlasErrorSummary.forException(new UnauthorizedException( "API key is unauthorised" )) ); } Person person; try { person = complexify(deserialize(new InputStreamReader(req.getInputStream()))); } catch (UnrecognizedPropertyException | JsonParseException | ConstraintViolationException e) { return error(req, resp, AtlasErrorSummary.forException(e)); } catch (IOException ioe) { log.error("Error reading input for request " + req.getRequestURL(), ioe); return error(req, resp, AtlasErrorSummary.forException(ioe)); } catch (Exception e) { log.error("Error reading input for request " + req.getRequestURL(), e); AtlasErrorSummary errorSummary = new AtlasErrorSummary(e) .withMessage("Error reading input for the request") .withStatusCode(HttpStatusCode.BAD_REQUEST); return error(req, resp, errorSummary); } if (!possibleConfig.requireValue().canWrite(person.getPublisher())) { return error( req, resp, AtlasErrorSummary.forException(new ForbiddenException( "API key does not have write permission")) ); } try { person = merge(resolveExisting(person), person, merge); store.createOrUpdatePerson(person); } catch (Exception e) { log.error("Error reading input for request " + req.getRequestURL(), e); AtlasErrorSummary errorSummary = new AtlasErrorSummary(e) .withStatusCode(HttpStatusCode.BAD_REQUEST); return error(req, resp, errorSummary); } resp.setStatus(HttpStatusCode.OK.code()); resp.setContentLength(0); return null; }