if (task.getTaskComments() != null) { TaskComment lastComment = task.getTaskComments().stream().max(Comparator.comparing(TaskComment::getCommentDate)).orElse(null); // StackTraceElement[] stackTraceElement = StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); System.out.println("fuck caller is " + stackTraceElements[3].getMethodName()); System.out.println("fuck task number is " + task.getNumber()); System.out.println("fuck last comment is null? " + (lastComment == null)); if (lastComment != null) { System.out.println("fuck text lastComment - " + lastComment.getComment()); subs.put("text", lastComment.getComment()); subs.put("date_comment", lastComment.getCommentDate().format(DD_MM_YYYY_HH24_MM_SS_DASH_FORMATTER)); subs.put("author_comment", isNotEmpty(lastComment.getUser()) ? lastComment.getUser().getName() : lastComment.getUserName());