]> source.dussan.org Git - sonarqube.git/commitdiff
Revert "Fix quality flaws"
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 18 Jun 2015 16:30:50 +0000 (18:30 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 18 Jun 2015 16:30:50 +0000 (18:30 +0200)
This reverts commit 47bad47ae07d3ffc895f3e76261d637073c57981 which breaks the compiltation of SQ

server/sonar-server/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java
sonar-application/src/main/java/org/sonar/application/JdbcSettings.java
sonar-core/src/main/java/org/sonar/core/notification/package-info.java [new file with mode: 0644]
sonar-core/src/main/java/org/sonar/core/qualityprofile/package-info.java [new file with mode: 0644]
sonar-home/src/main/java/org/sonar/home/cache/FileCache.java
sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java

index 5a08ed9718e961272829421f991d4bcabc51ba34..5e004e69b2b11c7f08c08332e51c150dd2504389 100644 (file)
@@ -95,8 +95,8 @@ public class EmailNotificationChannel extends NotificationChannel {
   @Override
   public void deliver(Notification notification, String username) {
     User user = userFinder.findByLogin(username);
-    if (user == null || StringUtils.isBlank(user.email())) {
-      LOG.debug("User does not exist or has no email: {}", username);
+    if (StringUtils.isBlank(user.email())) {
+      LOG.debug("Email not defined for user: " + username);
       return;
     }
     EmailMessage emailMessage = format(notification);
index 8684bf06e82f963c22db0229e0fed1a89fb745ff..cbfbf4d62659ebe7c107fd5506c6cd6d59a1dacc 100644 (file)
@@ -22,7 +22,6 @@ package org.sonar.application;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.LoggerFactory;
-import org.sonar.api.utils.log.Loggers;
 import org.sonar.process.MessageException;
 import org.sonar.process.ProcessProperties;
 import org.sonar.process.Props;
@@ -33,8 +32,6 @@ import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import static java.lang.String.format;
-
 public class JdbcSettings {
 
   enum Provider {
@@ -76,13 +73,13 @@ public class JdbcSettings {
     Pattern pattern = Pattern.compile("jdbc:(\\w+):.+");
     Matcher matcher = pattern.matcher(url);
     if (!matcher.find()) {
-      throw new MessageException(format("Bad format of JDBC URL: %s", url));
+      throw new MessageException(String.format("Bad format of JDBC URL: " + url));
     }
     String key = matcher.group(1);
     try {
       return Provider.valueOf(StringUtils.upperCase(key));
     } catch (IllegalArgumentException e) {
-      throw new MessageException(format("Unsupported JDBC driver provider: %s", key));
+      throw new MessageException(String.format(String.format("Unsupported JDBC driver provider: %s", key)));
     }
   }
 
@@ -97,13 +94,13 @@ public class JdbcSettings {
 
   private static void checkRequiredParameter(String url, String val) {
     if (!url.contains(val)) {
-      throw new MessageException(format("JDBC URL must have the property '%s'", val));
+      throw new MessageException(String.format("JDBC URL must have the property '%s'", val));
     }
   }
 
   private void checkRecommendedParameter(String url, String val) {
     if (!url.contains(val)) {
-      Loggers.get(getClass()).warn("JDBC URL is recommended to have the property '{}'", val);
+      LoggerFactory.getLogger(getClass()).warn(String.format("JDBC URL is recommended to have the property '%s'", val));
     }
   }
 }
diff --git a/sonar-core/src/main/java/org/sonar/core/notification/package-info.java b/sonar-core/src/main/java/org/sonar/core/notification/package-info.java
new file mode 100644 (file)
index 0000000..c53b6d4
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.core.notification;
+
+import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-core/src/main/java/org/sonar/core/qualityprofile/package-info.java b/sonar-core/src/main/java/org/sonar/core/qualityprofile/package-info.java
new file mode 100644 (file)
index 0000000..0f09c0f
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.core.qualityprofile;
+
+import javax.annotation.ParametersAreNonnullByDefault;
index 5998b97a2c5dc9ba3a606cdf26f549824a6eafbe..3b681edcff1cc1d24145b56207d03094e90189f4 100644 (file)
@@ -106,7 +106,7 @@ public class FileCache {
     // 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("A copy/delete will be tempted but with no guarantee of atomicity");
+      log.warn(String.format("A copy/delete will be tempted but with no garantee of atomicity"));
       try {
         Files.move(sourceFile.toPath(), targetFile.toPath());
       } catch (IOException e) {
index 66da90e88aeed46fadafe4c4cdb2c1588f24595c..4590325141198004064d5c8ecec9de4921dd4ebc 100644 (file)
@@ -65,18 +65,15 @@ public final class ZipUtils {
   }
 
   public static File unzip(InputStream zip, File toDir) throws IOException {
-    unzip(zip, toDir, TrueZipEntryFilter.INSTANCE);
+    unzip(zip, toDir, new ZipEntryFilter() {
+      @Override
+      public boolean accept(ZipEntry entry) {
+        return true;
+      }
+    });
     return toDir;
   }
 
-  private enum TrueZipEntryFilter implements ZipEntryFilter {
-    INSTANCE;
-    @Override
-    public boolean accept(ZipEntry entry) {
-      return true;
-    }
-  }
-
   public static File unzip(InputStream stream, File toDir, ZipEntryFilter filter) throws IOException {
     if (!toDir.exists()) {
       FileUtils.forceMkdir(toDir);