From ac42939501b33d60ef700c3087a26b3591583714 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 15 Apr 2014 22:45:53 +0200 Subject: [PATCH] Fix some quality flaws --- .../java/org/sonar/batch/scan/filesystem/FileIndexer.java | 3 ++- .../java/org/sonar/api/server/rule/RulesDefinition.java | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileIndexer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileIndexer.java index 3d09990018e..b9d784723fa 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileIndexer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileIndexer.java @@ -110,9 +110,10 @@ public class FileIndexer implements BatchComponent { Collection files = FileUtils.listFiles(dirToIndex, FILE_FILTER, DIR_FILTER); for (File file : files) { DefaultInputFile inputFile = inputFileBuilder.create(file); - if (inputFile != null && exclusionFilters.accept(inputFile, type)) + if (inputFile != null && exclusionFilters.accept(inputFile, type)) { indexFile(inputFileBuilder, fileSystem, status, inputFile, type); } + } } private void indexFile(InputFileBuilder inputFileBuilder, DefaultModuleFileSystem fs, diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java index 831a05f1155..a3b099a37b6 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java @@ -538,8 +538,8 @@ public interface RulesDefinition extends ServerExtension { /** * Required rule name */ - public NewRule setName(String s) { - this.name = StringUtils.trim(s); + public NewRule setName(@Nullable String s) { + this.name = StringUtils.trimToNull(s); return this; } @@ -556,8 +556,8 @@ public interface RulesDefinition extends ServerExtension { return this; } - public NewRule setHtmlDescription(String s) { - this.htmlDescription = StringUtils.trim(s); + public NewRule setHtmlDescription(@Nullable String s) { + this.htmlDescription = StringUtils.trimToNull(s); return this; } -- 2.39.5