From 01b0ee18572b75b76f45d4b8207dc77af6ae1cab Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Tue, 19 Jan 2016 09:50:15 +0100 Subject: [PATCH] Cut dependency between sonar-core and sonar-home --- sonar-core/pom.xml | 4 ---- .../java/org/sonar/core/platform/RemotePlugin.java | 10 ++++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sonar-core/pom.xml b/sonar-core/pom.xml index 4a7ae54ef77..7738b4d2a93 100644 --- a/sonar-core/pom.xml +++ b/sonar-core/pom.xml @@ -43,10 +43,6 @@ org.codehaus.sonar sonar-update-center-common - - ${project.groupId} - sonar-home - diff --git a/sonar-core/src/main/java/org/sonar/core/platform/RemotePlugin.java b/sonar-core/src/main/java/org/sonar/core/platform/RemotePlugin.java index 65e9d683cb5..d7e24418de4 100644 --- a/sonar-core/src/main/java/org/sonar/core/platform/RemotePlugin.java +++ b/sonar-core/src/main/java/org/sonar/core/platform/RemotePlugin.java @@ -20,8 +20,10 @@ package org.sonar.core.platform; import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang.StringUtils; -import org.sonar.home.cache.FileHashes; public class RemotePlugin { private String pluginKey; @@ -64,7 +66,11 @@ public class RemotePlugin { } public RemotePlugin setFile(File f) { - return this.setFile(f.getName(), new FileHashes().of(f)); + try (FileInputStream fis = new FileInputStream(f)) { + return this.setFile(f.getName(), DigestUtils.md5Hex(fis)); + } catch (IOException e) { + throw new IllegalStateException("Fail to compute hash", e); + } } public RemotePluginFile file() { -- 2.39.5