Skip to content

Commit 0d533e6

Browse files
fix: resolve spotbugs exception softening violation
1 parent b406e5e commit 0d533e6

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/main/java/com/thealgorithms/sorts/ConcurrentMergeSort.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private static void concurrentMergeSort(int[] array, int[] temp, int left, int r
9393
leftTask.get();
9494
} catch (InterruptedException | ExecutionException e) {
9595
Thread.currentThread().interrupt();
96-
throw new RuntimeException("Concurrent execution interrupted or failed", e);
96+
throw new IllegalStateException("Concurrent execution interrupted or failed", e);
9797
}
9898

9999
merge(array, temp, left, mid, right);

src/test/java/com/thealgorithms/sorts/ConcurrentMergeSortTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public void testInterruptedException() {
9797
Thread.currentThread().interrupt();
9898
try {
9999
ConcurrentMergeSort.sort(array);
100-
} catch (RuntimeException e) {
100+
} catch (IllegalStateException e) {
101101
org.junit.jupiter.api.Assertions.assertTrue(e.getCause() instanceof InterruptedException || e.getCause() instanceof java.util.concurrent.ExecutionException, "Should catch and wrap InterruptedException or ExecutionException");
102102
} finally {
103103
// Clear interrupted status so it doesn't affect subsequent tests

0 commit comments

Comments
 (0)