aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2016-01-06 14:17:53 +0100
committerDuarte Meneses <duarte.meneses@sonarsource.com>2016-01-06 16:19:19 +0100
commit14fde3c0c46e717ac44a0b482f21f82149e2e837 (patch)
tree13d1a4ce3eb23115f02f024940db597ea096f33d /sonar-batch
parent0429a8b70f7d60755f65602037d1c6fd01011c75 (diff)
downloadsonarqube-14fde3c0c46e717ac44a0b482f21f82149e2e837.tar.gz
sonarqube-14fde3c0c46e717ac44a0b482f21f82149e2e837.zip
SONAR-7121 Project's File Lock not released on error
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java5
1 files 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();
}