Github user nickwallen commented on a diff in the pull request: https://github.com/apache/metron/pull/1190#discussion_r216726476 --- Diff: metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/dao/ElasticsearchUpdateDao.java --- @@ -133,21 +135,21 @@ public void addCommentToAlert(CommentAddRemoveRequest request, Document latest) Document newVersion = new Document(latest); newVersion.getDocument().put(COMMENTS_FIELD, originalComments); - update(newVersion, Optional.empty()); + return update(newVersion, Optional.empty()); } @Override @SuppressWarnings("unchecked") - public void removeCommentFromAlert(CommentAddRemoveRequest request) throws IOException { + public Document removeCommentFromAlert(CommentAddRemoveRequest request) throws IOException { Document latest = retrieveLatestDao.getLatest(request.getGuid(), request.getSensorType()); - removeCommentFromAlert(request, latest); + return removeCommentFromAlert(request, latest); } @Override @SuppressWarnings("unchecked") - public void removeCommentFromAlert(CommentAddRemoveRequest request, Document latest) throws IOException { + public Document removeCommentFromAlert(CommentAddRemoveRequest request, Document latest) throws IOException { if (latest == null) { - return; + return null; --- End diff -- Same comment here. We should never see a request to remove a comment from a doc that doesn't exist. So let's throw an exception with a message that we can use to debug the problem.
---