Source:
<code>public Response returnToAuthor(@PathParam("id") String idSupplied, String jsonBody) { if (jsonBody == null || jsonBody.isEmpty()) { return error(Response.Status.BAD_REQUEST, "You must supply JSON to this API endpoint and it must contain a reason for returning the dataset."); } StringReader rdr = new StringReader(jsonBody); JsonObject json = Json.createReader(rdr).readObject(); try { Dataset dataset = findDatasetOrDie(idSupplied); String reasonForReturn = null; try { reasonForReturn = json.getString("reasonForReturn"); <START> } catch (NullPointerException ex) { <END> return error(Response.Status.BAD_REQUEST, "The JSON you supplied does not contain a reason for returning the dataset to the author(s)."); } if (reasonForReturn == null || reasonForReturn.isEmpty()) { return error(Response.Status.BAD_REQUEST, "You must enter a reason for returning a dataset to the author(s)."); } int numCharsAllowed = 200; int numCharsProvided = reasonForReturn.length(); if (numCharsProvided > numCharsAllowed) { return error(Response.Status.BAD_REQUEST, "You supplied " + numCharsProvided + " in the reason for return but only " + numCharsAllowed + " characters are allowed."); } DatasetVersion datasetVersion = dataset.getLatestVersion(); Dataset updatedDataset = execCommand(new ReturnDatasetToAuthorCommand(createDataverseRequest(findUserOrDie()), dataset)); DatasetVersion latestVersion = updatedDataset.getLatestVersion(); Comment comment = new Comment(reasonForReturn, latestVersion); datasetSvc.saveComment(comment); boolean inReview = latestVersion.isInReview(); JsonObjectBuilder result = Json.createObjectBuilder(); result.add("inReview", inReview); result.add("message", "Dataset id " + updatedDataset.getId() + " has been sent back to the author(s)."); return ok(result); } catch (WrappedResponse wr) { return wr.getResponse(); } }</code><technical_language>if statement here</technical_language>

Target:
public Response returnToAuthor(@PathParam("id") String idSupplied, String jsonBody) { if (jsonBody == null || jsonBody.isEmpty()) { return error(Response.Status.BAD_REQUEST, "You must supply JSON to this API endpoint and it must contain a reason for returning the dataset."); } StringReader rdr = new StringReader(jsonBody); JsonObject json = Json.createReader(rdr).readObject(); try { Dataset dataset = findDatasetOrDie(idSupplied); String reasonForReturn = null; reasonForReturn = json.getString("reasonForReturn"); if (reasonForReturn == null || reasonForReturn.isEmpty()) { return error(Response.Status.BAD_REQUEST, "You must enter a reason for returning a dataset to the author(s)."); } AuthenticatedUser authenticatedUser = findAuthenticatedUserOrDie(); Dataset updatedDataset = execCommand(new ReturnDatasetToAuthorCommand(createDataverseRequest(authenticatedUser), dataset, reasonForReturn )); DatasetVersion latestVersion = updatedDataset.getLatestVersion(); boolean inReview = latestVersion.isInReview(); JsonObjectBuilder result = Json.createObjectBuilder(); result.add("inReview", inReview); result.add("message", "Dataset id " + updatedDataset.getId() + " has been sent back to the author(s)."); return ok(result); } catch (WrappedResponse wr) { return wr.getResponse(); } }