diff options
author | Mykola Nikishov | 2016-12-30 20:44:19 +0000 |
---|---|---|
committer | Pascal Rapicault | 2017-03-30 15:06:44 +0000 |
commit | 4033ed6c359057d98b05191f198885d0477d8219 (patch) | |
tree | ac6974a95ae522effb9e27bc393b1ffb7eeeeb95 | |
parent | 5be3ee98548c39fa52804fbb4ce2c1d3c647a63b (diff) | |
download | rt.equinox.p2-4033ed6c359057d98b05191f198885d0477d8219.tar.gz rt.equinox.p2-4033ed6c359057d98b05191f198885d0477d8219.tar.xz rt.equinox.p2-4033ed6c359057d98b05191f198885d0477d8219.zip |
Bug 423715 - Rename checksum-related constants in SimpleArtifactRepositoryI20170402-2000I20170401-2000I20170331-2000I20170330-2000
SimpleArtifactRepository provides two properties to control if p2
client should validate artifact's MD5 checksums. Rename constants that
store names of these properties to better reflect their purpose.
Change-Id: I2147e366fb5d20da21c123998cf9c73510e8de24
Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2 files changed, 16 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java index f4f7dcec9..800da28bf 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 IBM Corporation and others. + * Copyright (c) 2009, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -79,7 +79,7 @@ public class RawMirrorRequest extends MirrorRequest { // Perform the mirror operation without any processing steps protected IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { ProcessingStepHandler handler = new ProcessingStepHandler(); - if (SimpleArtifactRepository.MD5_CHECK_ENABLED && descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_MD5) != null) + if (SimpleArtifactRepository.DOWNLOAD_MD5_CHECKSUM_ENABLED && descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_MD5) != null) destination = handler.link(new ProcessingStep[] {new MD5Verifier(descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_MD5))}, destination, monitor); return getSourceRepository().getRawArtifact(descriptor, destination, monitor); } 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 b9bf5864a..130bc2c97 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -54,9 +54,18 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme */ public static final boolean MIRRORS_ENABLED = !"false".equals(Activator.getContext().getProperty("eclipse.p2.mirrors")); //$NON-NLS-1$//$NON-NLS-2$ - public static final boolean MD5_CHECK_ENABLED = !"false".equals(Activator.getContext().getProperty("eclipse.p2.MD5Check")); //$NON-NLS-1$//$NON-NLS-2$ + /** + * A boolean property controlling whether MD5 checksum of the artifact bytes that are transferred should be checked. + * @see IArtifactDescriptor#DOWNLOAD_MD5 + */ + public static final boolean DOWNLOAD_MD5_CHECKSUM_ENABLED = !"false".equals(Activator.getContext().getProperty("eclipse.p2.MD5Check")); //$NON-NLS-1$//$NON-NLS-2$ - public static final boolean MD5_ARTIFACT_CHECK_ENABLED = !"false".equals(Activator.getContext().getProperty("eclipse.p2.MD5ArtifactCheck")); //$NON-NLS-1$//$NON-NLS-2$ + /** + * A boolean property controlling whether MD5 checksum of the artifact bytes in its native format (after processing steps have + * been applied) should be checked. + * @see IArtifactDescriptor#ARTIFACT_MD5 + */ + public static final boolean ARTIFACT_MD5_CHECKSUM_ENABLED = !"false".equals(Activator.getContext().getProperty("eclipse.p2.MD5ArtifactCheck")); //$NON-NLS-1$//$NON-NLS-2$ public static final String CONTENT_FILENAME = "artifacts"; //$NON-NLS-1$ @@ -435,7 +444,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme private synchronized OutputStream addPostSteps(ProcessingStepHandler handler, IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { ArrayList<ProcessingStep> steps = new ArrayList<ProcessingStep>(); steps.add(new SignatureVerifier()); - if (MD5_ARTIFACT_CHECK_ENABLED && descriptor.getProperty(IArtifactDescriptor.ARTIFACT_MD5) != null) + if (ARTIFACT_MD5_CHECKSUM_ENABLED && descriptor.getProperty(IArtifactDescriptor.ARTIFACT_MD5) != null) steps.add(new MD5Verifier(descriptor.getProperty(IArtifactDescriptor.ARTIFACT_MD5))); if (steps.isEmpty()) return destination; @@ -448,7 +457,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme ArrayList<ProcessingStep> steps = new ArrayList<ProcessingStep>(); if (IArtifactDescriptor.TYPE_ZIP.equals(descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE))) steps.add(new ZipVerifierStep()); - if (MD5_CHECK_ENABLED && descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_MD5) != null) + if (DOWNLOAD_MD5_CHECKSUM_ENABLED && descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_MD5) != null) steps.add(new MD5Verifier(descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_MD5))); // Add steps here if needed if (steps.isEmpty()) |