aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-02-13 23:12:41 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2013-02-13 23:12:41 +0100
commit84792078764ce7e6dbdffabb03f40f3bf2bb37b7 (patch)
treee26db56c81249666ef6345bf302a2c33e7e08860
parent963f99920272b142ce0bcfa091bd85ee61fee369 (diff)
downloadsonarqube-84792078764ce7e6dbdffabb03f40f3bf2bb37b7.tar.gz
sonarqube-84792078764ce7e6dbdffabb03f40f3bf2bb37b7.zip
Fix quality flaws
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFileFilter.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/maven/MavenPluginsConfigurator.java1
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/maven/MavenProjectConverter.java7
-rw-r--r--sonar-home/src/main/java/org/sonar/home/cache/FileCache.java18
4 files changed, 13 insertions, 15 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFileFilter.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFileFilter.java
index a6fe2f7793f..a039475398f 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFileFilter.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFileFilter.java
@@ -125,7 +125,7 @@ public class ExclusionFileFilter implements FileFilter, ResourceFilter, BatchCom
return testExclusions;
}
- static abstract class FilePattern {
+ abstract static class FilePattern {
final WildcardPattern pattern;
protected FilePattern(String pattern) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/maven/MavenPluginsConfigurator.java b/sonar-batch/src/main/java/org/sonar/batch/scan/maven/MavenPluginsConfigurator.java
index 60c418fed94..6986e01564a 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/maven/MavenPluginsConfigurator.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/maven/MavenPluginsConfigurator.java
@@ -28,7 +28,6 @@ import org.sonar.api.batch.BatchExtensionDictionnary;
import org.sonar.api.batch.maven.MavenPlugin;
import org.sonar.api.batch.maven.MavenPluginHandler;
import org.sonar.api.resources.Project;
-import org.sonar.api.utils.SonarException;
import java.io.File;
import java.io.FileWriter;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/maven/MavenProjectConverter.java b/sonar-batch/src/main/java/org/sonar/batch/scan/maven/MavenProjectConverter.java
index 9a98c6c0de6..396cd2b6939 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/maven/MavenProjectConverter.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/maven/MavenProjectConverter.java
@@ -50,7 +50,8 @@ public class MavenProjectConverter {
}
public static ProjectDefinition convert(List<MavenProject> poms, MavenProject root) {
- Map<String, MavenProject> paths = Maps.newHashMap(); // projects by canonical path to pom.xml
+ // projects by canonical path to pom.xml
+ Map<String, MavenProject> paths = Maps.newHashMap();
Map<MavenProject, ProjectDefinition> defs = Maps.newHashMap();
try {
@@ -85,7 +86,6 @@ public class MavenProjectConverter {
if (rootProject == null) {
throw new IllegalStateException(UNABLE_TO_DETERMINE_PROJECT_STRUCTURE_EXCEPTION_MESSAGE);
}
-
return rootProject;
}
@@ -107,7 +107,8 @@ public class MavenProjectConverter {
static ProjectDefinition convert(MavenProject pom) {
String key = new StringBuilder().append(pom.getGroupId()).append(":").append(pom.getArtifactId()).toString();
ProjectDefinition definition = ProjectDefinition.create();
- // IMPORTANT NOTE : reference on properties from POM model must not be saved, instead they should be copied explicitly - see SONAR-2896
+ // IMPORTANT NOTE : reference on properties from POM model must not be saved,
+ // instead they should be copied explicitly - see SONAR-2896
definition
.setProperties(pom.getModel().getProperties())
.setKey(key)
diff --git a/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java b/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java
index cab5cd9d635..0d2d457b040 100644
--- a/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java
+++ b/sonar-home/src/main/java/org/sonar/home/cache/FileCache.java
@@ -103,16 +103,14 @@ public class FileCache {
private void renameQuietly(File sourceFile, File targetFile) {
boolean rename = sourceFile.renameTo(targetFile);
- if (!rename) {
- // Check if the file was cached by another process during download
- if (!targetFile.exists()) {
- log.warn(String.format("Unable to rename %s to %s", sourceFile.getAbsolutePath(), targetFile.getAbsolutePath()));
- log.warn(String.format("A copy/delete will be tempted but with no garantee of atomicity"));
- try {
- FileUtils.moveFile(sourceFile, targetFile);
- } catch (IOException e) {
- throw new IllegalStateException("Fail to move " + sourceFile.getAbsolutePath() + " to " + targetFile, e);
- }
+ // Check if the file was cached by another process during download
+ if (!rename && !targetFile.exists()) {
+ log.warn(String.format("Unable to rename %s to %s", sourceFile.getAbsolutePath(), targetFile.getAbsolutePath()));
+ log.warn(String.format("A copy/delete will be tempted but with no garantee of atomicity"));
+ try {
+ FileUtils.moveFile(sourceFile, targetFile);
+ } catch (IOException e) {
+ throw new IllegalStateException("Fail to move " + sourceFile.getAbsolutePath() + " to " + targetFile, e);
}
}
}