Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMykola Nikishov2018-10-04 18:06:16 +0000
committerMickael Istria2018-10-09 12:58:51 +0000
commit8264452199d882c61ccbe30beb035208db379679 (patch)
tree75de65ec11683daea7e287c64ff1749a5d5945cf /bundles/org.eclipse.equinox.p2.artifact.repository
parentd0c7e750e28807226c7574c1550e183a23b09658 (diff)
downloadrt.equinox.p2-8264452199d882c61ccbe30beb035208db379679.tar.gz
rt.equinox.p2-8264452199d882c61ccbe30beb035208db379679.tar.xz
rt.equinox.p2-8264452199d882c61ccbe30beb035208db379679.zip
Simplify ChecksumUtilities' getLegacyMd5Verifier(String)
In ChecksumUtilities' getChecksumVerifiers, if artifact descriptor has ARTIFACT_MD5 or DOWNLOAD_MD5 properties, ChecksumHelper's getChecksums will populate checksums map with MD5 checksum. It makes no sense to duplicate logic from ChecksumHelper's getLegacyMd5Checksum in getLegacyMd5Verifier method, let it operate on MD5 checksum value directly. Change-Id: I867c1d0e11ec245eb07708553f265bde422d07f8 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumUtilities.java16
1 files changed, 2 insertions, 14 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 f5b583421..9a478c069 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
@@ -67,7 +67,7 @@ public class ChecksumUtilities {
}
}
- Optional<MD5Verifier> legacyMd5Verifier = getLegacyMd5Verifier(descriptor, property);
+ Optional<MD5Verifier> legacyMd5Verifier = getLegacyMd5Verifier(checksums.get(ChecksumHelper.MD5));
legacyMd5Verifier.ifPresent(verifier -> steps.add(verifier));
return steps;
@@ -138,19 +138,7 @@ public class ChecksumUtilities {
return properties;
}
- private static Optional<MD5Verifier> getLegacyMd5Verifier(IArtifactDescriptor descriptor, String propertyNamespace) {
- String md5 = null;
- switch (propertyNamespace) {
- case IArtifactDescriptor.ARTIFACT_CHECKSUM :
- md5 = descriptor.getProperty(IArtifactDescriptor.ARTIFACT_MD5);
- break;
- case IArtifactDescriptor.DOWNLOAD_CHECKSUM :
- md5 = descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_MD5);
- break;
- default :
- throw new IllegalArgumentException(propertyNamespace);
- }
-
+ private static Optional<MD5Verifier> getLegacyMd5Verifier(String md5) {
if (md5 != null) {
@SuppressWarnings("resource") //It's used later so shouldn't be closed
MD5Verifier checksumVerifier = new MD5Verifier(md5);

Back to the top