Reduce dependency on Guava 2 (#1590)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-02-03 00:43:10 +02:00
committed by GitHub
parent ee5e12a300
commit 791b87b27b
15 changed files with 81 additions and 59 deletions

View File

@@ -14,15 +14,12 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.eclipse.hawkbit.artifact.repository.model.AbstractDbArtifact;
import org.eclipse.hawkbit.artifact.repository.model.DbArtifactHash;
import org.springframework.validation.annotation.Validated;
import com.google.common.base.Splitter;
/**
* Implementation of the {@link ArtifactRepository} to store artifacts on the
* file-system. The files are stored by their SHA1 hash of the artifact binary.
@@ -94,9 +91,8 @@ public class ArtifactFilesystemRepository extends AbstractArtifactRepository {
private Path getSha1DirectoryPath(final String tenant, final String sha1) {
final int length = sha1.length();
final List<String> folders = Splitter.fixedLength(2).splitToList(sha1.substring(length - 4, length));
final String folder1 = folders.get(0);
final String folder2 = folders.get(1);
final String folder1 = sha1.substring(length - 4, length - 2);
final String folder2 = sha1.substring(length - 2, length);
return Paths.get(artifactResourceProperties.getPath(), sanitizeTenant(tenant), folder1, folder2);
}