diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-12-07 15:45:24 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-12-07 16:02:17 +0100 |
commit | 42f17286694370e73b48db38cbc3b328ff10764c (patch) | |
tree | 7454a9547a82e16eaef4bb10e09aa7b0b7239297 /sonar-batch | |
parent | 70eac6ea0e564da3735a3d80065326cee10c7c48 (diff) | |
download | sonarqube-42f17286694370e73b48db38cbc3b328ff10764c.tar.gz sonarqube-42f17286694370e73b48db38cbc3b328ff10764c.zip |
Fix quality flaws
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java index af56d4a04dc..79e4e2db95d 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java @@ -30,9 +30,17 @@ import org.sonar.api.batch.Event; import org.sonar.api.batch.SonarIndex; import org.sonar.api.database.model.ResourceModel; import org.sonar.api.design.Dependency; -import org.sonar.api.measures.*; +import org.sonar.api.measures.Measure; +import org.sonar.api.measures.MeasuresFilter; +import org.sonar.api.measures.MeasuresFilters; +import org.sonar.api.measures.Metric; +import org.sonar.api.measures.MetricFinder; import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.*; +import org.sonar.api.resources.Project; +import org.sonar.api.resources.ProjectLink; +import org.sonar.api.resources.Resource; +import org.sonar.api.resources.ResourceUtils; +import org.sonar.api.resources.Scopes; import org.sonar.api.rules.ActiveRule; import org.sonar.api.rules.Violation; import org.sonar.api.utils.SonarException; @@ -42,7 +50,14 @@ import org.sonar.batch.ProjectTree; import org.sonar.batch.ResourceFilters; import org.sonar.batch.ViolationFilters; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; public class DefaultIndex extends SonarIndex { @@ -448,10 +463,10 @@ public class DefaultIndex extends SonarIndex { if (!StringUtils.equals(Scopes.PROJECT, resource.getScope())) { // not a project nor a library uid = new StringBuilder(ResourceModel.KEY_SIZE) - .append(project.getKey()) - .append(':') - .append(resource.getKey()) - .toString(); + .append(project.getKey()) + .append(':') + .append(resource.getKey()) + .toString(); } return uid; } @@ -540,10 +555,8 @@ public class DefaultIndex extends SonarIndex { } private void checkLock(Resource resource) { - if (lock.isLocked() && !ResourceUtils.isLibrary(resource)) { - if (lock.isFailWhenLocked()) { - throw new SonarException("Index is locked, resource can not be indexed: " + resource); - } + if (lock.isLocked() && !ResourceUtils.isLibrary(resource) && lock.isFailWhenLocked()) { + throw new SonarException("Index is locked, resource can not be indexed: " + resource); } } |