diff options
author | Mykola Nikishov | 2018-10-04 16:58:30 +0000 |
---|---|---|
committer | Mykola Nikishov | 2018-10-05 11:31:19 +0000 |
commit | 02ceef70510167c357b7cf205476fc234f2bef57 (patch) | |
tree | 031e48ab800116f2e80ced483f4e66496fd31e44 | |
parent | 4a68dc6e98b35cefb9b99fa0f4ff644b00a88747 (diff) | |
download | rt.equinox.p2-02ceef70510167c357b7cf205476fc234f2bef57.tar.gz rt.equinox.p2-02ceef70510167c357b7cf205476fc234f2bef57.tar.xz rt.equinox.p2-02ceef70510167c357b7cf205476fc234f2bef57.zip |
Reuse ChecksumHelper.MD5 constantI20181008-0600
Change-Id: Ic011655240f2772e9356ab5a17e8a54eb3700236
Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
3 files changed, 8 insertions, 8 deletions
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<String> md5 = calculateChecksum(pathOnDisk, status, MD5_ID, MD5_MESSAGE_DIGEST); - md5.ifPresent(c -> checksums.put(MD5_ID, c)); + Optional<String> 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<String, String> checksums, HashMap<String, String> 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<ProcessingStep> steps = new ArrayList<>(); steps.add(new SignatureVerifier()); - Set<String> skipChecksums = ARTIFACT_MD5_CHECKSUM_ENABLED ? Collections.emptySet() : Collections.singleton(ChecksumUtilities.MD5_ID); + Set<String> 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<String> skipChecksums = DOWNLOAD_MD5_CHECKSUM_ENABLED ? Collections.emptySet() : Collections.singleton(ChecksumUtilities.MD5_ID); + Set<String> skipChecksums = DOWNLOAD_MD5_CHECKSUM_ENABLED ? Collections.emptySet() : Collections.singleton(ChecksumHelper.MD5); addChecksumVerifiers(descriptor, steps, skipChecksums, IArtifactDescriptor.DOWNLOAD_CHECKSUM); // Add steps here if needed diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/ChecksumHelper.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/ChecksumHelper.java index f985733fb..6fb253ae7 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/ChecksumHelper.java +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/ChecksumHelper.java @@ -19,7 +19,7 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; public class ChecksumHelper { - private static final String MD5 = "md5"; //$NON-NLS-1$ + public static final String MD5 = "md5"; //$NON-NLS-1$ /** * @param property either {@link IArtifactDescriptor#ARTIFACT_CHECKSUM} or {@link IArtifactDescriptor#DOWNLOAD_CHECKSUM} |