From 428fbadc5f117da2a8e2bb8a9e43ddbf809f6fdb Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 7 Dec 2012 10:15:29 +0100 Subject: [PATCH] Fix some quality flaws --- .../src/main/java/org/sonar/batch/bootstrapper/Reactor.java | 3 ++- .../src/main/java/org/sonar/core/resource/ResourceDao.java | 4 ++-- .../java/org/sonar/api/checks/AnnotationCheckFactory.java | 6 ++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/Reactor.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/Reactor.java index 1e907c30c0e..8c2d23d3da5 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/Reactor.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/Reactor.java @@ -25,9 +25,10 @@ import java.util.List; /** * Describes order of projects. - * Used by sonar-runner 1.x. Gradle 1.0 already uses {#link org.sonar.api.batch.bootstrap.ProjectReactor}. + * Used by sonar-runner 1.x. Gradle 1.0 already uses {@link org.sonar.api.batch.bootstrap.ProjectReactor}. * * @since 2.6 + * @deprecated replaced by {@link org.sonar.api.batch.bootstrap.ProjectReactor} in version 2.9 */ @Deprecated public class Reactor { diff --git a/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java b/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java index b8a7c88e546..b4f9e35f856 100644 --- a/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java +++ b/sonar-core/src/main/java/org/sonar/core/resource/ResourceDao.java @@ -81,8 +81,8 @@ public class ResourceDao { } public SnapshotDto getLastSnapshotByResourceId(long resourceId, SqlSession session) { - return session.getMapper(ResourceMapper.class).selectLastSnapshotByResourceId(resourceId); - } + return session.getMapper(ResourceMapper.class).selectLastSnapshotByResourceId(resourceId); + } public List getDescendantProjects(long projectId) { SqlSession session = mybatis.openSession(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java index b5d407ea3a8..9101b71db48 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/checks/AnnotationCheckFactory.java @@ -150,10 +150,8 @@ public final class AnnotationCheckFactory extends CheckFactory { List fields = FieldUtils2.getFields(check.getClass(), true); for (Field field : fields) { RuleProperty propertyAnnotation = field.getAnnotation(RuleProperty.class); - if (propertyAnnotation != null) { - if (StringUtils.equals(key, field.getName()) || StringUtils.equals(key, propertyAnnotation.key())) { - return field; - } + if (propertyAnnotation != null && (StringUtils.equals(key, field.getName()) || StringUtils.equals(key, propertyAnnotation.key()))) { + return field; } } return null; -- 2.39.5