]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some quality flaws
authorJulien HENRY <julien.henry@sonarsource.com>
Mon, 8 Dec 2014 10:50:52 +0000 (11:50 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Mon, 8 Dec 2014 10:50:52 +0000 (11:50 +0100)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/IssueTracking.java
sonar-batch/src/main/java/org/sonar/batch/maven/MavenProjectConverter.java
sonar-batch/src/main/java/org/sonar/batch/scan/ProjectSettings.java
sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java

index 884e298bd689394f1f493e863150bab5992060fa..da4059eeb0df5aced31c026364bb3a19994fead2 100644 (file)
@@ -82,8 +82,11 @@ public class IssueTracking implements BatchExtension {
 
     // If each new issue matches an old one we can stop the matching mechanism
     if (result.matched().size() != newIssues.size()) {
-      if (sourceHashHolder != null && sourceHashHolder.getHashedReference() != null && hasLastScan) {
-        mapNewissues(sourceHashHolder.getHashedReference(), sourceHashHolder.getHashedSource(), newIssues, result);
+      if (sourceHashHolder != null && hasLastScan) {
+        FileHashes hashedReference = sourceHashHolder.getHashedReference();
+        if (hashedReference != null) {
+          mapNewissues(hashedReference, sourceHashHolder.getHashedSource(), newIssues, result);
+        }
       }
       mapIssuesOnSameRule(newIssues, result);
     }
index 2ef3fe6fa5481cf64de08c2c427191c9ca90f711..6109b64542106d2d7740abffe8b2ecde917f1cd0 100644 (file)
@@ -40,6 +40,7 @@ import org.sonar.batch.scan.filesystem.DefaultModuleFileSystem;
 import org.sonar.java.api.JavaUtils;
 
 import javax.annotation.Nullable;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.Arrays;
@@ -190,7 +191,7 @@ public class MavenProjectConverter implements TaskExtension {
   }
 
   private static void setPropertyIfNotAlreadyExists(ProjectDefinition definition, String propertyKey, String propertyValue) {
-    if (StringUtils.isBlank(definition.getProperties().getProperty(propertyKey))) {
+    if (StringUtils.isBlank(definition.properties().get(propertyKey))) {
       definition.setProperty(propertyKey, StringUtils.defaultString(propertyValue));
     }
   }
index c2749ba0099a83eb2b023d0a728eae1d523c795a..72218e95ce3cb24b0e4be321976135cef27621eb 100644 (file)
@@ -55,7 +55,7 @@ public class ProjectSettings extends Settings {
 
     addProperties(projectReferentials.settings(reactor.getRoot().getKeyWithBranch()));
 
-    addProperties(reactor.getRoot().getProperties());
+    addProperties(reactor.getRoot().properties());
   }
 
   @Override
index e527f649b7beea80c529060ecbcfc21a7b3c0885..4822a4a89aa6617afc584673c47bb90b17b91c1b 100644 (file)
@@ -86,10 +86,6 @@ public class ProjectDefinition {
   private List<ProjectDefinition> subProjects = Lists.newArrayList();
   private List<Object> containerExtensions = Lists.newArrayList();
 
-  private ProjectDefinition(Map<String, String> p) {
-    this.properties = p;
-  }
-
   private ProjectDefinition(Properties p) {
     for (Entry<Object, Object> entry : p.entrySet()) {
       this.properties.put(entry.getKey().toString(), entry.getValue().toString());
@@ -162,6 +158,7 @@ public class ProjectDefinition {
    * @since 2.12
    * @deprecated since 5.0 use {@link #setProperties(Map)}
    */
+  @Deprecated
   public ProjectDefinition setProperties(Properties properties) {
     for (Entry<Object, Object> entry : properties.entrySet()) {
       this.properties.put(entry.getKey().toString(), entry.getValue().toString());