<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>
*/
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.
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);
+ }
}
}
}
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;
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 "";
}