@CheckForNull
private Notification createChangeNotification(DefaultIssue issue, IssueChangeContext context, Rule rule, Component project, @Nullable Component component, @Nullable String comment) {
- if (comment == null && (issue.currentChange() == null || issue.currentChange().diffs().isEmpty())) {
+ FieldDiffs currentChange = issue.currentChange();
+ if (comment == null && (currentChange == null || currentChange.diffs().isEmpty())) {
return null;
}
Notification notification = newNotification(project, "issue-changes");
notification.setFieldValue("comment", comment);
}
- FieldDiffs diffs = issue.currentChange();
- if (diffs != null) {
- for (Map.Entry<String, FieldDiffs.Diff> entry : diffs.diffs().entrySet()) {
+ if (currentChange != null) {
+ for (Map.Entry<String, FieldDiffs.Diff> entry : currentChange.diffs().entrySet()) {
String type = entry.getKey();
FieldDiffs.Diff diff = entry.getValue();
notification.setFieldValue("old." + type, diff.oldValue() != null ? diff.oldValue().toString() : null);
try {
deadLine = RubyUtils.toDate(deadLineParam);
Date today = new Date();
- if (deadLine.before(today) && !org.apache.commons.lang.time.DateUtils.isSameDay(deadLine, today)) {
+ if (deadLine != null && deadLine.before(today) && !org.apache.commons.lang.time.DateUtils.isSameDay(deadLine, today)) {
result.addError(Result.Message.ofL10n("action_plans.date_cant_be_in_past"));
}
} catch (SonarException e) {