Github user nickwallen commented on a diff in the pull request:
https://github.com/apache/metron/pull/1190#discussion_r216727723
--- Diff:
metron-platform/metron-indexing/src/main/java/org/apache/metron/indexing/dao/HBaseDao.java
---
@@ -280,14 +282,14 @@ protected Put buildPut(Document update) throws
IOException {
@Override
@SuppressWarnings("unchecked")
- public void addCommentToAlert(CommentAddRemoveRequest request) throws
IOException {
+ public Document addCommentToAlert(CommentAddRemoveRequest request)
throws IOException {
Document latest = 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 || latest.getDocument() == null) {
throw new IOException("Unable to add comment to document that
doesn't exist");
}
--- End diff --
This seems to match what I am suggesting we do in the Elasticsearch
implementation. If we don't have a document, we should thrown an exception.
I'd also argue that the error message provides no useful information to
help debug the problem. But that is a pre-existing condition. Would be nice
to clean-up though.
---