Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMykola Nikishov2018-12-26 06:44:20 -0500
committerMykola Nikishov2019-01-13 22:33:45 -0500
commit244078186f2065a1458e2ce46deb8021d82a6b05 (patch)
treef360a04d90f7fc1fd36659282647702e93b58f15
parentd37052d1aef964673ecebeab8ed2a6fe6c4e85f7 (diff)
downloadrt.equinox.p2-244078186f2065a1458e2ce46deb8021d82a6b05.tar.gz
rt.equinox.p2-244078186f2065a1458e2ce46deb8021d82a6b05.tar.xz
rt.equinox.p2-244078186f2065a1458e2ce46deb8021d82a6b05.zip
Bug 543047 - ChecksumVerifier should read checksum from processing step descriptor's data onlyY20190116-2200I20190116-1800I20190115-1800I20190114-1800
Initially, ChecksumVerifier has been modeled after MD5Verifier which tries to read artifact descriptor's properties and falls back to processing step descriptor's data. But ChecksumVerifier actually never touches artifact descriptor and its properties: - ChecksumUtilities's getChecksumVerifiers is the only method to create instances of ChecksumVerifier - ChecksumUtilities's getChecksumVerifiers knows the property to read checksum from and stores its value into processing step descriptor's data This decouples ChecksumVerifier from artifact descriptor properties. Change-Id: I635f89d598df6a90a068220f0c1ba31bf603b45d Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumVerifier.java12
1 files changed, 1 insertions, 11 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumVerifier.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumVerifier.java
index d0fcb1c06..34df102e6 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumVerifier.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/checksum/ChecksumVerifier.java
@@ -20,7 +20,6 @@ import java.security.NoSuchAlgorithmException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
-import org.eclipse.equinox.internal.p2.repository.helpers.ChecksumHelper;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
@@ -43,25 +42,16 @@ final public class ChecksumVerifier extends MessageDigestProcessingStep {
@Override
public final void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
super.initialize(agent, descriptor, context);
-
basicInitialize(descriptor);
if (!getStatus().isOK()) {
return;
}
- String data = descriptor.getData();
- if (IArtifactDescriptor.DOWNLOAD_CHECKSUM.concat(".").concat(algorithmId).equals(data)) //$NON-NLS-1$
- expectedChecksum = ChecksumHelper.getChecksums(context, IArtifactDescriptor.DOWNLOAD_CHECKSUM).get(algorithmId);
- else if (IArtifactDescriptor.ARTIFACT_CHECKSUM.concat(".").concat(algorithmId).equals(data)) //$NON-NLS-1$
- expectedChecksum = ChecksumHelper.getChecksums(context, IArtifactDescriptor.ARTIFACT_CHECKSUM).get(algorithmId);
- else
- expectedChecksum = data;
-
+ expectedChecksum = descriptor.getData();
if (ofNullable(expectedChecksum).orElse("").isEmpty()) { //$NON-NLS-1$
int code = buildErrorCode(descriptor);
setStatus(new Status(code, Activator.ID, NLS.bind(Messages.Error_invalid_checksum, algorithmName, expectedChecksum)));
}
-
}
private void basicInitialize(IProcessingStepDescriptor descriptor) {

Back to the top