From fb04c3bb1dc2c80bb9a81ffb4a1b5985789582bd Mon Sep 17 00:00:00 2001 From: BarminaA Date: Sat, 24 Apr 2021 19:23:44 +0400 Subject: [PATCH] #26-Removing null from lineChange --- .../service/GitRepositoryService.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/ru/ulstu/extractor/service/GitRepositoryService.java b/src/main/java/ru/ulstu/extractor/service/GitRepositoryService.java index e2ecf19..a8384f8 100644 --- a/src/main/java/ru/ulstu/extractor/service/GitRepositoryService.java +++ b/src/main/java/ru/ulstu/extractor/service/GitRepositoryService.java @@ -251,8 +251,13 @@ public class GitRepositoryService { if (strings[i].startsWith("---")) { i++; } else { - lineChange.setLineFrom(lineChange.getLineFrom() + "\n" + strings[i]); - i++; + if (lineChange.getLineFrom() == null) { + lineChange.setLineFrom(strings[i]); + i++; + } else { + lineChange.setLineFrom(lineChange.getLineFrom() + "\n" + strings[i]); + i++; + } } } } @@ -261,8 +266,13 @@ public class GitRepositoryService { if (strings[i].startsWith("+++")) { i++; } else { - lineChange.setLineTo(lineChange.getLineTo() + "\n" + strings[i]); - i++; + if (lineChange.getLineTo() == null) { + lineChange.setLineTo(strings[i]); + i++; + } else { + lineChange.setLineTo(lineChange.getLineTo() + "\n" + strings[i]); + i++; + } } } }