Skip to content

Commit 1956296

Browse files
brad4dcopybara-github
authored andcommitted
Prepare for upgrade to java-diff-utils 4.12
The new version of the library doesn't have a `DiffException` that the current version forces us to catch. We cannot upgrade to the library and change the code that uses it in the same change for complicated reasons, so instead catch `Exception` to remove the use of a soon-to-be-eliminated class. PiperOrigin-RevId: 567365082
1 parent f73beec commit 1956296

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/com/google/javascript/rhino/testing/TextDiffFactsBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545

4646
import com.github.difflib.DiffUtils;
4747
import com.github.difflib.UnifiedDiffUtils;
48-
import com.github.difflib.algorithm.DiffException;
4948
import com.github.difflib.patch.Patch;
5049
import com.google.common.base.Splitter;
5150
import com.google.common.collect.ImmutableList;
@@ -92,7 +91,8 @@ public ImmutableList<Fact> build() {
9291
UnifiedDiffUtils.generateUnifiedDiff(
9392
"expected", "actual", expectedLines, patch, /* contextSize= */ 10);
9493
return ImmutableList.of(fact(title, unifiedDiff.stream().collect(joining("\n"))));
95-
} catch (DiffException e) {
94+
} catch (Exception e) {
95+
// TODO: b/238438892 - Remove the try/catch entirely after upgrading to java-diff-utils 4.12
9696
// It's unclear when this exception happens.
9797
// It may indicate a bug in the diff library itself.
9898
throw new IllegalStateException(e);

0 commit comments

Comments
 (0)