From 02ceef70510167c357b7cf205476fc234f2bef57 Mon Sep 17 00:00:00 2001 From: Mykola Nikishov Date: Thu, 4 Oct 2018 19:58:30 +0300 Subject: Reuse ChecksumHelper.MD5 constant Change-Id: Ic011655240f2772e9356ab5a17e8a54eb3700236 Signed-off-by: Mykola Nikishov --- .../p2/artifact/processors/checksum/ChecksumUtilities.java | 9 ++++----- .../p2/artifact/repository/simple/SimpleArtifactRepository.java | 5 +++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository') diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumUtilities.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumUtilities.java index 4bd7d6283..f5b583421 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumUtilities.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumUtilities.java @@ -31,7 +31,6 @@ import org.eclipse.osgi.util.NLS; public class ChecksumUtilities { private static final String ARTIFACT_CHECKSUMS_POINT = "org.eclipse.equinox.p2.artifact.repository.artifactChecksums"; //$NON-NLS-1$ - public static final String MD5_ID = "md5"; //$NON-NLS-1$ private static final String MD5_MESSAGE_DIGEST = "MD5"; //$NON-NLS-1$ /** @@ -99,10 +98,10 @@ public class ChecksumUtilities { checksum.ifPresent(c -> checksums.put(id, c)); } - boolean doNotSkipMd5 = !checksumsToSkip.contains(MD5_ID); + boolean doNotSkipMd5 = !checksumsToSkip.contains(ChecksumHelper.MD5); if (doNotSkipMd5) { - Optional md5 = calculateChecksum(pathOnDisk, status, MD5_ID, MD5_MESSAGE_DIGEST); - md5.ifPresent(c -> checksums.put(MD5_ID, c)); + Optional md5 = calculateChecksum(pathOnDisk, status, ChecksumHelper.MD5, MD5_MESSAGE_DIGEST); + md5.ifPresent(c -> checksums.put(ChecksumHelper.MD5, c)); } return status; @@ -163,7 +162,7 @@ public class ChecksumUtilities { } private static void putLegacyMd5Property(String propertyNamespace, Map checksums, HashMap result) { - String md5 = checksums.get(ChecksumUtilities.MD5_ID); + String md5 = checksums.get(ChecksumHelper.MD5); if (md5 != null) { if (IArtifactDescriptor.ARTIFACT_CHECKSUM.equals(propertyNamespace)) result.put(IArtifactDescriptor.ARTIFACT_MD5, md5); diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java index 6f6320828..cde8a99a2 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java @@ -37,6 +37,7 @@ import org.eclipse.equinox.internal.p2.metadata.expression.CompoundIterator; import org.eclipse.equinox.internal.p2.metadata.index.IndexProvider; import org.eclipse.equinox.internal.p2.repository.DownloadStatus; import org.eclipse.equinox.internal.p2.repository.Transport; +import org.eclipse.equinox.internal.p2.repository.helpers.ChecksumHelper; import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.*; import org.eclipse.equinox.internal.provisional.p2.repository.IStateful; import org.eclipse.equinox.p2.core.IProvisioningAgent; @@ -475,7 +476,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme ArrayList steps = new ArrayList<>(); steps.add(new SignatureVerifier()); - Set skipChecksums = ARTIFACT_MD5_CHECKSUM_ENABLED ? Collections.emptySet() : Collections.singleton(ChecksumUtilities.MD5_ID); + Set skipChecksums = ARTIFACT_MD5_CHECKSUM_ENABLED ? Collections.emptySet() : Collections.singleton(ChecksumHelper.MD5); addChecksumVerifiers(descriptor, steps, skipChecksums, IArtifactDescriptor.ARTIFACT_CHECKSUM); if (steps.isEmpty()) @@ -490,7 +491,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme if (IArtifactDescriptor.TYPE_ZIP.equals(descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE))) steps.add(new ZipVerifierStep()); - Set skipChecksums = DOWNLOAD_MD5_CHECKSUM_ENABLED ? Collections.emptySet() : Collections.singleton(ChecksumUtilities.MD5_ID); + Set skipChecksums = DOWNLOAD_MD5_CHECKSUM_ENABLED ? Collections.emptySet() : Collections.singleton(ChecksumHelper.MD5); addChecksumVerifiers(descriptor, steps, skipChecksums, IArtifactDescriptor.DOWNLOAD_CHECKSUM); // Add steps here if needed -- cgit v1.2.3