Github user nickwallen commented on a diff in the pull request:

    https://github.com/apache/metron/pull/1190#discussion_r216725905
  
    --- Diff: 
metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/dao/ElasticsearchUpdateDao.java
 ---
    @@ -108,20 +109,21 @@ public void batchUpdate(Map<Document, 
Optional<String>> updates) throws IOExcept
           throw new IOException(
               "ElasticsearchDao upsert failed: " + 
bulkResponse.buildFailureMessage());
         }
    +    return updates;
       }
     
       @Override
       @SuppressWarnings("unchecked")
    -  public void addCommentToAlert(CommentAddRemoveRequest request) throws 
IOException {
    +  public Document addCommentToAlert(CommentAddRemoveRequest request) 
throws IOException {
         Document latest = retrieveLatestDao.getLatest(request.getGuid(), 
request.getSensorType());
    -    addCommentToAlert(request, latest);
    +    return addCommentToAlert(request, latest);
       }
     
       @Override
       @SuppressWarnings("unchecked")
    -  public void addCommentToAlert(CommentAddRemoveRequest request, Document 
latest) throws IOException {
    +  public Document addCommentToAlert(CommentAddRemoveRequest request, 
Document latest) throws IOException {
         if (latest == null) {
    -      return;
    +      return null;
    --- End diff --
    
    The `latest` would only be null if there was a request to comment on a 
non-existent meta-alert, correct? If that is the case, then this *should* never 
happen.  Wouldn't it be better to throw an exception with an appropriate error 
message so we can investigate the thing that should not have happened?
    



---

Reply via email to