diff --git a/build.gradle b/build.gradle index 501ed8f6743..3a02e604e55 100644 --- a/build.gradle +++ b/build.gradle @@ -133,7 +133,7 @@ dependencies { libreoffice 'org.libreoffice:ridl:6.4.3' libreoffice 'org.libreoffice:unoil:6.4.3' - implementation 'io.github.java-diff-utils:java-diff-utils:4.5' + implementation 'io.github.java-diff-utils:java-diff-utils:4.7' implementation 'info.debatty:java-string-similarity:1.2.1' antlr3 'org.antlr:antlr:3.5.2' diff --git a/src/main/java/org/jabref/gui/mergeentries/DiffHighlighting.java b/src/main/java/org/jabref/gui/mergeentries/DiffHighlighting.java index 4b93edbb8c8..514ce4fe370 100644 --- a/src/main/java/org/jabref/gui/mergeentries/DiffHighlighting.java +++ b/src/main/java/org/jabref/gui/mergeentries/DiffHighlighting.java @@ -8,7 +8,6 @@ import javafx.scene.text.Text; import com.github.difflib.DiffUtils; -import com.github.difflib.algorithm.DiffException; import com.github.difflib.patch.AbstractDelta; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -23,13 +22,7 @@ private DiffHighlighting() { public static List generateDiffHighlighting(String baseString, String modifiedString, String separator) { List stringList = Arrays.asList(baseString.split(separator)); List result = stringList.stream().map(text -> forUnchanged(text + separator)).collect(Collectors.toList()); - List> deltaList; - try { - deltaList = DiffUtils.diff(stringList, Arrays.asList(modifiedString.split(separator))).getDeltas(); - } catch (DiffException e) { - LOGGER.error("Error while generating diff of " + baseString + " and " + modifiedString); - return Collections.emptyList(); - } + List> deltaList = DiffUtils.diff(stringList, Arrays.asList(modifiedString.split(separator))).getDeltas(); Collections.reverse(deltaList); for (AbstractDelta delta : deltaList) { int startPos = delta.getSource().getPosition(); @@ -87,13 +80,7 @@ public static Text forRemoved(String text) { public static List generateSymmetricHighlighting(String baseString, String modifiedString, String separator) { List stringList = Arrays.asList(baseString.split(separator)); List result = stringList.stream().map(text -> DiffHighlighting.forUnchanged(text + separator)).collect(Collectors.toList()); - List> deltaList; - try { - deltaList = DiffUtils.diff(stringList, Arrays.asList(modifiedString.split(separator))).getDeltas(); - } catch (DiffException e) { - LOGGER.error("Error while generating diff of " + baseString + " and " + modifiedString); - return Collections.emptyList(); - } + List> deltaList = DiffUtils.diff(stringList, Arrays.asList(modifiedString.split(separator))).getDeltas(); Collections.reverse(deltaList); for (AbstractDelta delta : deltaList) { int startPos = delta.getSource().getPosition();