From 295a87208f8c9898fbdc733a438587dc03a16877 Mon Sep 17 00:00:00 2001 From: Matteo Mara Date: Mon, 9 Jan 2023 10:21:46 +0100 Subject: [NO-JIRA] Remove reported code smells about usage of instanceof --- .../main/java/org/sonar/ce/task/CeTaskInterruptedException.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'server/sonar-ce-task/src') diff --git a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTaskInterruptedException.java b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTaskInterruptedException.java index 0c50abd1087..5ab9674b1e8 100644 --- a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTaskInterruptedException.java +++ b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/CeTaskInterruptedException.java @@ -37,8 +37,8 @@ public abstract class CeTaskInterruptedException extends RuntimeException { } public static Optional isTaskInterruptedException(Throwable e) { - if (e instanceof CeTaskInterruptedException) { - return Optional.of((CeTaskInterruptedException) e); + if (e instanceof CeTaskInterruptedException ceTaskInterruptedException) { + return Optional.of(ceTaskInterruptedException); } return isCauseInterruptedException(e); } @@ -48,8 +48,8 @@ public abstract class CeTaskInterruptedException extends RuntimeException { if (cause == null || cause == e) { return Optional.empty(); } - if (cause instanceof CeTaskInterruptedException) { - return Optional.of((CeTaskInterruptedException) cause); + if (cause instanceof CeTaskInterruptedException ceTaskInterruptedException) { + return Optional.of(ceTaskInterruptedException); } return isCauseInterruptedException(cause); } -- cgit v1.2.3