]> source.dussan.org Git - sonarqube.git/commitdiff
Fix quality flaws
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 14 Jan 2015 17:27:20 +0000 (18:27 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 14 Jan 2015 17:36:52 +0000 (18:36 +0100)
server/sonar-server/src/main/java/org/sonar/server/component/DefaultRubyComponentService.java
server/sonar-server/src/main/java/org/sonar/server/db/migrations/v51/CopyScmAccountsFromAuthorsToUsers.java
server/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java
server/sonar-server/src/test/java/org/sonar/server/component/DefaultRubyComponentServiceTest.java
sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanDto.java
sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanStatsDto.java

index 6ed564077856d7d69bbc132eb839a902a8c9868f..30f4ced420e73520116c9fc37d18252d49b70374 100644 (file)
@@ -22,7 +22,6 @@ package org.sonar.server.component;
 import com.google.common.base.Strings;
 import org.sonar.api.component.Component;
 import org.sonar.api.component.RubyComponentService;
-import org.sonar.api.i18n.I18n;
 import org.sonar.api.resources.Qualifiers;
 import org.sonar.core.component.ComponentDto;
 import org.sonar.core.resource.ResourceDao;
@@ -41,13 +40,11 @@ public class DefaultRubyComponentService implements RubyComponentService {
   private final ResourceDao resourceDao;
   private final DefaultComponentFinder finder;
   private final ComponentService componentService;
-  private final I18n i18n;
 
-  public DefaultRubyComponentService(ResourceDao resourceDao, DefaultComponentFinder finder, ComponentService componentService, I18n i18n) {
+  public DefaultRubyComponentService(ResourceDao resourceDao, DefaultComponentFinder finder, ComponentService componentService) {
     this.resourceDao = resourceDao;
     this.finder = finder;
     this.componentService = componentService;
-    this.i18n = i18n;
   }
 
   @Override
index ab401370f2ccfd3089a58641e97a4e82b96e5e2f..b5ed489b3506eb802fb4c012e236e221d4893689 100644 (file)
@@ -113,9 +113,12 @@ public class CopyScmAccountsFromAuthorsToUsers extends BaseDataChange {
     }
     Select select = context.prepareSelect(sql.toString());
     select.setBoolean(1, true);
-    int currentIndex = 2;
+    int currentIndex = 1;
     for (String author : authors) {
-      select.setString(currentIndex++, author).setString(currentIndex++, author);
+      currentIndex++;
+      select.setString(currentIndex, author);
+      currentIndex++;
+      select.setString(currentIndex, author);
     }
 
     select.scroll(new Select.RowHandler() {
index 2da4ffc443cc12e49adc9a383e3693d0d3c2d70e..26721ddb5a6ee5b34a812bd5de8de755c2ddb9b2 100644 (file)
@@ -104,6 +104,7 @@ public class DuplicationsParser implements ServerComponent {
 
   @VisibleForTesting
   static class DuplicationComparator implements Comparator<Duplication> {
+    private static final long serialVersionUID = 1;
 
     private final ComponentDto component;
 
@@ -146,6 +147,8 @@ public class DuplicationsParser implements ServerComponent {
   }
 
   private static class BlockComparator implements Comparator<Block> {
+    private static final long serialVersionUID = 1;
+
     @Override
     public int compare(@Nullable Block b1,
       @Nullable Block b2) {
index b9483a0015f5108bb62388c6dec57fd84683d3a1..c05ad5ac6751c1a6379f20812af295db6f37c99a 100644 (file)
@@ -24,7 +24,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.sonar.api.component.Component;
-import org.sonar.api.i18n.I18n;
 import org.sonar.api.resources.Qualifiers;
 import org.sonar.core.component.ComponentDto;
 import org.sonar.core.resource.ResourceDao;
@@ -45,7 +44,6 @@ public class DefaultRubyComponentServiceTest {
   ResourceDao resourceDao;
   DefaultComponentFinder finder;
   ComponentService componentService;
-  I18n i18n;
 
   DefaultRubyComponentService service;
 
@@ -54,8 +52,7 @@ public class DefaultRubyComponentServiceTest {
     resourceDao = mock(ResourceDao.class);
     finder = mock(DefaultComponentFinder.class);
     componentService = mock(ComponentService.class);
-    i18n = mock(I18n.class);
-    service = new DefaultRubyComponentService(resourceDao, finder, componentService, i18n);
+    service = new DefaultRubyComponentService(resourceDao, finder, componentService);
   }
 
   @Test
index 07b6f81cc581b4599de0b7a324a4b1f4846c47d6..fac4c384dab14ca79edca1eff501d0f850269f87 100644 (file)
@@ -46,8 +46,8 @@ public class ActionPlanDto {
   private Date createdAt;
   private Date updatedAt;
 
-  // joins
-  private transient String projectKey;
+  // return by joins
+  private String projectKey;
 
   public Long getId() {
     return id;
index 217f0358f32572dba1120922f6073b478e99e363..8f7e5dd38e61931990de457f2c557e800eadc218 100644 (file)
@@ -43,8 +43,8 @@ public class ActionPlanStatsDto {
   private Date updatedAt;
   private int totalIssues;
   private int unresolvedIssues;
-  // joins
-  private transient String projectKey;
+  // return by joins
+  private String projectKey;
 
   public Integer getId() {
     return id;