issue 1807 fix for comment , filter diff entry if it has null diff
@@ -32,6 +32,7 @@ import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
+import java.util.Objects;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -130,7 +131,9 @@ public final class DiffUtils {
final DiffParser diffParser = new UnifiedDiffParser();
return GitParsedDiff.builder()
.entries(
- gitReaderDiff.getEntries().stream().flatMap(diff -> {
+ gitReaderDiff.getEntries().stream()
+ .filter(entry -> Objects.nonNull(entry.getDiff()))
+ .flatMap(diff -> {
final String[] diffsByFile = diff.getDiff().split(DIFF_GIT_PREFIX);
return Arrays.stream(diffsByFile)
.filter(org.apache.commons.lang.StringUtils::isNotBlank)
@@ -139,11 +142,13 @@ public final class DiffUtils {
GitParsedDiffEntry.builder().commit(
diff.getCommit().toBuilder()
.authorDate(
- new Date(diff.getCommit().getAuthorDate().toInstant()
+ new Date(diff.getCommit().getAuthorDate()
+ .toInstant()
.plus(reportFilters.getUserTimeOffsetInMin(),
ChronoUnit.MINUTES).toEpochMilli()))
.committerDate(
- new Date(diff.getCommit().getCommitterDate().toInstant()
+ new Date(diff.getCommit().getCommitterDate()
+ .toInstant()
.plus(reportFilters.getUserTimeOffsetInMin(),
ChronoUnit.MINUTES).toEpochMilli())
).build());
