Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2008-10-20 20:22:45 -0400
committerPascal Rapicault2008-10-20 20:22:45 -0400
commita10b993845dc1883ce91bad0b945db96acf75030 (patch)
tree8f26a3d68a73f01f89916e229a163a5762b7c900 /bundles/org.eclipse.equinox.p2.artifact.processors
parent914b5e9ca1205942b5be96b61bae3a6e69bcbab3 (diff)
downloadrt.equinox.p2-a10b993845dc1883ce91bad0b945db96acf75030.tar.gz
rt.equinox.p2-a10b993845dc1883ce91bad0b945db96acf75030.tar.xz
rt.equinox.p2-a10b993845dc1883ce91bad0b945db96acf75030.zip
Bug 222870 - Enabled MD5 processing stepv20081021
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.processors')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.processors/plugin.xml5
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/verifier/MD5Verifier.java83
3 files changed, 2 insertions, 91 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF
index b07bc2d51..d93837da5 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.artifact.processors/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.artifact.processors;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 1.0.100.qualifier
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
J2SE-1.4
@@ -25,7 +25,6 @@ Import-Package: ie.wombat.jbdiff,
Bundle-Vendor: %providerName
Export-Package: org.eclipse.equinox.internal.p2.artifact.processors;x-internal:=true,
org.eclipse.equinox.internal.p2.artifact.processors.jardelta;x-internal:=true,
- org.eclipse.equinox.internal.p2.artifact.processors.jbdiff;x-internal:=true,
- org.eclipse.equinox.internal.p2.artifact.processors.verifier;x-internal:=true
+ org.eclipse.equinox.internal.p2.artifact.processors.jbdiff;x-internal:=true
Bundle-Activator: org.eclipse.equinox.internal.p2.artifact.processors.Activator
Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/plugin.xml b/bundles/org.eclipse.equinox.p2.artifact.processors/plugin.xml
index 94a700302..2b083618c 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.processors/plugin.xml
+++ b/bundles/org.eclipse.equinox.p2.artifact.processors/plugin.xml
@@ -16,9 +16,4 @@
id="org.eclipse.equinox.p2.processing.JBPatchZipStep">
<step class="org.eclipse.equinox.internal.p2.artifact.processors.jbdiff.JBPatchZipStep"/>
</extension>
- <extension
- point="org.eclipse.equinox.p2.artifact.repository.processingSteps"
- id="org.eclipse.equinox.p2.processing.MD5Verifier">
- <step class="org.eclipse.equinox.internal.p2.artifact.processors.verifier.MD5Verifier"/>
- </extension>
</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/verifier/MD5Verifier.java b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/verifier/MD5Verifier.java
deleted file mode 100644
index 11161de66..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/verifier/MD5Verifier.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 compeople AG 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- * IBM Corporation - ongoing development
- *******************************************************************************/
-package org.eclipse.equinox.internal.p2.artifact.processors.verifier;
-
-import java.io.IOException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.equinox.internal.p2.artifact.processors.Activator;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepDescriptor;
-
-public class MD5Verifier extends ProcessingStep {
-
- protected String md5Test;
- private MessageDigest md5;
-
- public MD5Verifier() {
- super();
- }
-
- public MD5Verifier(String md5Test) {
- super();
- this.md5Test = md5Test;
- basicInitialize(null);
- }
-
- public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
- super.initialize(descriptor, context);
- String data = descriptor.getData();
- if (data.equals("download"))
- md5Test = context.getProperty(IArtifactDescriptor.DOWNLOAD_MD5);
- else if (data.equals("artifact"))
- md5Test = context.getProperty(IArtifactDescriptor.ARTIFACT_MD5);
- else
- md5Test = data;
- basicInitialize(descriptor);
- }
-
- private void basicInitialize(ProcessingStepDescriptor descriptor) {
- int code = (descriptor == null) ? IStatus.ERROR : descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
- if (md5Test == null || md5Test.length() != 32)
- setStatus(new Status(code, Activator.ID, "MD5 value not available or incorrect size"));
- try {
- md5 = MessageDigest.getInstance("MD5");
- } catch (NoSuchAlgorithmException e) {
- setStatus(new Status(code, Activator.ID, "Could not create MD5 algorithm", e));
- }
- }
-
- public void write(int b) throws IOException {
- if (b != -1)
- md5.update((byte) b);
- getDestination().write(b);
- }
-
- public void close() throws IOException {
- super.close();
-
- byte[] digest = md5.digest();
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < digest.length; i++) {
- if ((digest[i] & 0xFF) < 0x10)
- buf.append('0');
- buf.append(Integer.toHexString(digest[i] & 0xFF));
- }
-
- // if the hashes don't line up set the status to error.
- if (!buf.toString().equals(md5Test))
- setStatus(new Status(IStatus.ERROR, Activator.ID, "Error processing stream. MD5 hash is not as expected."));
- }
-}

Back to the top