]> source.dussan.org Git - sonarqube.git/commitdiff
Cut dependency between sonar-server and sonar-home
authorJulien HENRY <julien.henry@sonarsource.com>
Tue, 19 Jan 2016 08:54:46 +0000 (09:54 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Tue, 19 Jan 2016 13:45:02 +0000 (14:45 +0100)
server/sonar-server/pom.xml
server/sonar-server/src/main/java/org/sonar/server/batch/BatchIndex.java
server/sonar-server/src/main/java/org/sonar/server/startup/JdbcDriverDeployer.java

index 9cdec318a9c6f832ee5ee1d29c38de763d8b5ab8..e03b5d898055a7d6f38d628925a3a9e2edf8dadd 100644 (file)
       <groupId>${project.groupId}</groupId>
       <artifactId>sonar-batch-protocol</artifactId>
     </dependency>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>sonar-home</artifactId>
-    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>sonar-markdown</artifactId>
index 83757dadee1609ce833fee4c8bfd9adcae75ab2d..451ab800945ebeb06996e4d3e198fadf39da76e7 100644 (file)
  */
 package org.sonar.server.batch;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Collection;
+import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.filefilter.FileFilterUtils;
 import org.apache.commons.io.filefilter.HiddenFileFilter;
 import org.apache.commons.lang.CharUtils;
 import org.apache.commons.lang.StringUtils;
 import org.picocontainer.Startable;
-import org.sonar.api.server.ServerSide;
 import org.sonar.api.platform.Server;
-import org.sonar.home.cache.FileHashes;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
+import org.sonar.api.server.ServerSide;
 
 /**
  * JAR files to be downloaded by sonar-runner.
@@ -56,7 +56,11 @@ public class BatchIndex implements Startable {
       for (File file : files) {
         String filename = file.getName();
         if (StringUtils.endsWith(filename, ".jar")) {
-          sb.append(filename).append('|').append(new FileHashes().of(file)).append(CharUtils.LF);
+          try (FileInputStream fis = new FileInputStream(file)) {
+            sb.append(filename).append('|').append(DigestUtils.md5Hex(fis)).append(CharUtils.LF);
+          } catch (IOException e) {
+            throw new IllegalStateException("Fail to compute hash", e);
+          }
         }
       }
     }
index 0181d298c4a90b6ca52ef47f5087491b618c175e..af48fb77df5ec73e01f9d670eb3be8dc224c34e6 100644 (file)
 package org.sonar.server.startup;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import javax.annotation.Nullable;
+import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.io.FileUtils;
 import org.sonar.api.config.Settings;
-import org.sonar.home.cache.FileHashes;
 import org.sonar.process.ProcessProperties;
 import org.sonar.server.platform.DefaultServerFileSystem;
 
@@ -66,8 +67,12 @@ public class JdbcDriverDeployer {
 
   private static String driverIndexContent(@Nullable File deployedDriver) {
     if (deployedDriver != null) {
-      String hash = new FileHashes().of(deployedDriver);
-      return deployedDriver.getName() + "|" + hash;
+      try (FileInputStream fis = new FileInputStream(deployedDriver)) {
+        String hash = DigestUtils.md5Hex(fis);
+        return deployedDriver.getName() + "|" + hash;
+      } catch (IOException e) {
+        throw new IllegalStateException("Fail to compute hash", e);
+      }
     }
     return "";
   }