Skip to content

Commit

Permalink
fix: handle existing document gracefully (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
kotharironak authored Aug 9, 2022
1 parent 148ca1d commit 0a35e0e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,9 @@ private Optional<Long> getCreatedTime(Key key) throws IOException {
CloseableIterator<Document> iterator = searchDocsForKeys(Set.of(key));
if (iterator.hasNext()) {
JsonNode existingDocument = getDocAsJSON(iterator.next());
return Optional.of(existingDocument.get(DocStoreConstants.CREATED_TIME).asLong());
if (existingDocument.has(DocStoreConstants.CREATED_TIME)) {
return Optional.of(existingDocument.get(DocStoreConstants.CREATED_TIME).asLong());
}
}
return Optional.empty();
}
Expand Down

0 comments on commit 0a35e0e

Please sign in to comment.