From 14fde3c0c46e717ac44a0b482f21f82149e2e837 Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Wed, 6 Jan 2016 14:17:53 +0100 Subject: [PATCH] SONAR-7121 Project's File Lock not released on error --- .../main/java/org/sonar/batch/scan/ProjectScanContainer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java index 63485f49f08..da67178b802 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java @@ -99,6 +99,7 @@ public class ProjectScanContainer extends ComponentContainer { private static final Logger LOG = Loggers.get(ProjectScanContainer.class); private final AnalysisProperties props; + private ProjectLock lock; public ProjectScanContainer(ComponentContainer globalContainer, AnalysisProperties props) { super(globalContainer); @@ -108,7 +109,8 @@ public class ProjectScanContainer extends ComponentContainer { @Override protected void doBeforeStart() { addBatchComponents(); - getComponentByType(ProjectLock.class).tryLock(); + lock = getComponentByType(ProjectLock.class); + lock.tryLock(); addBatchExtensions(); Settings settings = getComponentByType(Settings.class); if (settings != null && settings.getBoolean(CoreProperties.PROFILING_LOG_PROPERTY)) { @@ -125,7 +127,6 @@ public class ProjectScanContainer extends ComponentContainer { return super.startComponents(); } catch (Exception e) { // ensure that lock is released - ProjectLock lock = getComponentByType(ProjectLock.class); if (lock != null) { lock.stop(); } -- 2.39.5