From cfe948ac7022510f47e22ee3c9d2f4ae3681b55c Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Mon, 29 Apr 2024 01:54:01 +0200 Subject: [errorprone] Fix pattern CatchAndPrintStackTrace See https://errorprone.info/bugpattern/CatchAndPrintStackTrace Change-Id: I7a6698293d1485f384c275bf7e4dcddc529af4a1 --- .../attributes/merge/MergeGitAttributeTest.java | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'org.eclipse.jgit.test/tst') diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/merge/MergeGitAttributeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/merge/MergeGitAttributeTest.java index 6b23de3320..009ca8a152 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/merge/MergeGitAttributeTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/merge/MergeGitAttributeTest.java @@ -19,6 +19,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.UncheckedIOException; import java.nio.file.Files; import java.util.function.Consumer; @@ -97,19 +98,19 @@ public class MergeGitAttributeTest extends RepositoryTestCase { try { writeTrashFile("main.cat", "A\n" + "B\n" + "C\n" + "D\n"); } catch (IOException e) { - e.printStackTrace(); + throw new UncheckedIOException(e); } }, g -> { try { writeTrashFile("main.cat", "A\n" + "B\n" + "C\n" + "F\n"); } catch (IOException e) { - e.printStackTrace(); + throw new UncheckedIOException(e); } }, g -> { try { writeTrashFile("main.cat", "A\n" + "E\n" + "C\n" + "D\n"); } catch (IOException e) { - e.printStackTrace(); + throw new UncheckedIOException(e); } })) { checkoutBranch(REFS_HEADS_LEFT); @@ -139,19 +140,19 @@ public class MergeGitAttributeTest extends RepositoryTestCase { writeTrashFile(".gitattributes", "*.cat -merge"); writeTrashFile("main.cat", "A\n" + "B\n" + "C\n" + "D\n"); } catch (IOException e) { - e.printStackTrace(); + throw new UncheckedIOException(e); } }, g -> { try { writeTrashFile("main.cat", "A\n" + "B\n" + "C\n" + "F\n"); } catch (IOException e) { - e.printStackTrace(); + throw new UncheckedIOException(e); } }, g -> { try { writeTrashFile("main.cat", "A\n" + "E\n" + "C\n" + "D\n"); } catch (IOException e) { - e.printStackTrace(); + throw new UncheckedIOException(e); } })) { // Check that the merge attribute is unset @@ -184,19 +185,19 @@ public class MergeGitAttributeTest extends RepositoryTestCase { writeTrashFile(".gitattributes", "*.txt -merge"); writeTrashFile("main.cat", "A\n" + "B\n" + "C\n" + "D\n"); } catch (IOException e) { - e.printStackTrace(); + throw new UncheckedIOException(e); } }, g -> { try { writeTrashFile("main.cat", "A\n" + "B\n" + "C\n" + "F\n"); } catch (IOException e) { - e.printStackTrace(); + throw new UncheckedIOException(e); } }, g -> { try { writeTrashFile("main.cat", "A\n" + "E\n" + "C\n" + "D\n"); } catch (IOException e) { - e.printStackTrace(); + throw new UncheckedIOException(e); } })) { // Check that the merge attribute is unset @@ -228,19 +229,19 @@ public class MergeGitAttributeTest extends RepositoryTestCase { writeTrashFile(".gitattributes", "*.cat merge=binary"); writeTrashFile("main.cat", "A\n" + "B\n" + "C\n" + "D\n"); } catch (IOException e) { - e.printStackTrace(); + throw new UncheckedIOException(e); } }, g -> { try { writeTrashFile("main.cat", "A\n" + "B\n" + "C\n" + "F\n"); } catch (IOException e) { - e.printStackTrace(); + throw new UncheckedIOException(e); } }, g -> { try { writeTrashFile("main.cat", "A\n" + "E\n" + "C\n" + "D\n"); } catch (IOException e) { - e.printStackTrace(); + throw new UncheckedIOException(e); } })) { // Check that the merge attribute is set to binary -- cgit v1.2.3