From ba74234cfdff3bd958c6364d6cfe1e7d89329c51 Mon Sep 17 00:00:00 2001 From: kamiljarmusik Date: Mon, 7 Aug 2023 18:45:00 +0200 Subject: [PATCH] #2634 Fix possible Unreleased lock - Lock outside the try block --- src/com/serotonin/timer/TimerTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/serotonin/timer/TimerTask.java b/src/com/serotonin/timer/TimerTask.java index f48e78f738..f5f6c9620a 100644 --- a/src/com/serotonin/timer/TimerTask.java +++ b/src/com/serotonin/timer/TimerTask.java @@ -88,8 +88,8 @@ public boolean cancel() { boolean result = (state == SCHEDULED); if (completeBeforeCancel) { + cancelLock.writeLock().lock(); try { - cancelLock.writeLock().lock(); state = CANCELLED; } finally {