]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some Quality flaws
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 27 Jun 2016 07:51:40 +0000 (09:51 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 27 Jun 2016 07:51:40 +0000 (09:51 +0200)
server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java
server/sonar-process-monitor/src/main/java/org/sonar/process/monitor/Timeouts.java
server/sonar-server/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java
server/sonar-server/src/main/java/org/sonar/server/search/QueryContext.java
sonar-core/src/main/java/org/sonar/core/util/ProgressLogger.java
sonar-db/src/main/java/org/sonar/db/dashboard/WidgetPropertyDao.java
sonar-db/src/main/java/org/sonar/db/rule/RuleDto.java
sonar-db/src/main/java/org/sonar/db/user/GroupMembershipDao.java
sonar-home/src/main/java/org/sonar/home/cache/FileCache.java
sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/WorkDuration.java

index 34887667ca51d9861fa223333bc12d553bfc1dc0..532d5b592a8749d3af7010faf5bd32dbb98d51d0 100644 (file)
@@ -109,7 +109,7 @@ public class CeServer implements Monitored {
       while (!stopAwait) {
         try {
           // wait for a quite long time but we will be interrupted if flag changes anyway
-          Thread.sleep(10000);
+          Thread.sleep(10_000);
         } catch (InterruptedException e) {
           // continue and check the flag
         }
index 51c1e5ef77758d2a8ea93fb55c1a1726c223f696..3db3a326453d84c49a5317437f1e227d75bd72f6 100644 (file)
@@ -31,7 +31,7 @@ class Timeouts {
   }
 
   public Timeouts() {
-    this(60000L);
+    this(60_000L);
   }
 
   /**
index f89f5f5ff6a3cb30b43348ab2c91637081a34ae9..d3f40feea2d430190479700b4ab50d129467bd9d 100644 (file)
@@ -53,7 +53,7 @@ public class EmailNotificationChannel extends NotificationChannel {
    * @see org.apache.commons.mail.Email#setSocketConnectionTimeout(int)
    * @see org.apache.commons.mail.Email#setSocketTimeout(int)
    */
-  private static final int SOCKET_TIMEOUT = 30000;
+  private static final int SOCKET_TIMEOUT = 30_000;
 
   /**
    * Email Header Field: "List-ID".
index 6dada64ab4bb4d787a677656965412ec4e767548..233a8cd72e45c60bddf26b1d4ff7a4642f2ab112 100644 (file)
@@ -127,7 +127,7 @@ public class QueryContext {
    * Limit on the number of results to return. Defaults to {@link #DEFAULT_LIMIT}.
    */
   public int getLimit() {
-    return showFullResult ? 999999 : limit;
+    return showFullResult ? 999_999 : limit;
   }
 
   /**
index b6ac17345e23099eff18fc2237c856d1364b617d..e69b02e09819396ddad98a52324fd0689ec3b91f 100644 (file)
@@ -30,7 +30,7 @@ import org.sonar.api.utils.log.Loggers;
  */
 public class ProgressLogger {
 
-  public static final long DEFAULT_PERIOD_MS = 60000L;
+  public static final long DEFAULT_PERIOD_MS = 60_000L;
 
   private final Timer timer;
   private final LoggerTimerTask task;
index 067838dcf26cefd7c6f46d7814d158cd4ccc6d83..7f1a66c54e3991fd909afbcc0df2f1dd768b6bfe 100644 (file)
@@ -75,11 +75,11 @@ public class WidgetPropertyDao implements Dao {
 
   public void deleteByWidgetIds(DbSession session, List<Long> widgetIdsWithPropertiesToDelete) {
     executeLargeInputs(
-        widgetIdsWithPropertiesToDelete,
-        input -> {
-          mapper(session).deleteByWidgetIds(input);
-          return Collections.emptyList();
-        });
+      widgetIdsWithPropertiesToDelete,
+      input -> {
+        mapper(session).deleteByWidgetIds(input);
+        return Collections.emptyList();
+      });
   }
 
   private static WidgetPropertyMapper mapper(DbSession session) {
index 55afe2e559ec65b8e389eb188423c35f41d9f179..5f78606ee515aacd442b00e36ef02344fa64cd3e 100644 (file)
@@ -312,11 +312,11 @@ public class RuleDto {
   }
 
   public Set<String> getTags() {
-    return tags == null ? new HashSet<String>() : new TreeSet<>(Arrays.asList(StringUtils.split(tags, ',')));
+    return tags == null ? new HashSet<>() : new TreeSet<>(Arrays.asList(StringUtils.split(tags, ',')));
   }
 
   public Set<String> getSystemTags() {
-    return systemTags == null ? new HashSet<String>() : new TreeSet<>(Arrays.asList(StringUtils.split(systemTags, ',')));
+    return systemTags == null ? new HashSet<>() : new TreeSet<>(Arrays.asList(StringUtils.split(systemTags, ',')));
   }
 
   private String getTagsField() {
index cb0ad6dc6b8f5233b74d138443245329371771aa..eacda25b99b30ce7fde350d02913268e06b30383 100644 (file)
@@ -76,14 +76,14 @@ public class GroupMembershipDao implements Dao {
   public Map<String, Integer> countUsersByGroups(DbSession session, Collection<Long> groupIds) {
     Map<String, Integer> result = Maps.newHashMap();
     executeLargeInputs(
-        groupIds,
-        input -> {
-          List<GroupUserCount> userCounts = mapper(session).countUsersByGroup(input);
-          for (GroupUserCount count : userCounts) {
-            result.put(count.groupName(), count.userCount());
-          }
-          return userCounts;
-        });
+      groupIds,
+      input -> {
+        List<GroupUserCount> userCounts = mapper(session).countUsersByGroup(input);
+        for (GroupUserCount count : userCounts) {
+          result.put(count.groupName(), count.userCount());
+        }
+        return userCounts;
+      });
 
     return result;
   }
@@ -91,14 +91,14 @@ public class GroupMembershipDao implements Dao {
   public Multimap<String, String> selectGroupsByLogins(DbSession session, Collection<String> logins) {
     Multimap<String, String> result = ArrayListMultimap.create();
     executeLargeInputs(
-        logins,
-        input -> {
-          List<LoginGroup> groupMemberships = mapper(session).selectGroupsByLogins(input);
-          for (LoginGroup membership : groupMemberships) {
-            result.put(membership.login(), membership.groupName());
-          }
-          return groupMemberships;
-        });
+      logins,
+      input -> {
+        List<LoginGroup> groupMemberships = mapper(session).selectGroupsByLogins(input);
+        for (LoginGroup membership : groupMemberships) {
+          result.put(membership.login(), membership.groupName());
+        }
+        return groupMemberships;
+      });
 
     return result;
   }
index a723cf164de2e70247b5d2a55cd65ce8ad0d0e72..5f341985bf7cd5d5371f4add8ae0594a6a2bbb37 100644 (file)
@@ -32,7 +32,7 @@ import javax.annotation.CheckForNull;
 public class FileCache {
 
   /** Maximum loop count when creating temp directories. */
-  private static final int TEMP_DIR_ATTEMPTS = 10000;
+  private static final int TEMP_DIR_ATTEMPTS = 10_000;
 
   private final File dir;
   private final File tmpDir;
index f3c2bf812cd702fda7ec364bce3a0c2420e4d06d..f58a3918c5d808ce623421ff606e29582ea83764 100644 (file)
@@ -30,7 +30,7 @@ import org.apache.commons.lang.builder.ToStringStyle;
  */
 public class WorkDuration implements Serializable {
 
-  static final int DAY_POSITION_IN_LONG = 10000;
+  static final int DAY_POSITION_IN_LONG = 10_000;
   static final int HOUR_POSITION_IN_LONG = 100;
   static final int MINUTE_POSITION_IN_LONG = 1;