Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2013-07-10 14:14:08 -0400
committerJohn Arthorne2013-07-11 11:34:14 -0400
commit155e4ad7c5ab018e78f071027dccbe8d58e4f030 (patch)
tree3a5e39fe8ac7ecb21ce57ee8a0ec80c28f2a4f66 /bundles/org.eclipse.equinox.p2.artifact.repository
parent2b28d8f331bbcc60a31a35a2027c3d08d493bfef (diff)
downloadrt.equinox.p2-155e4ad7c5ab018e78f071027dccbe8d58e4f030.tar.gz
rt.equinox.p2-155e4ad7c5ab018e78f071027dccbe8d58e4f030.tar.xz
rt.equinox.p2-155e4ad7c5ab018e78f071027dccbe8d58e4f030.zip
Bug 411035 - Some tests depend on SignedContentFactory.getSignedContent(File) to return an empty unsigned SignedContent object when the input is an invalid zip file.
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
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/repository/SignatureVerifier.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java
index 99c9080ac..1b93ffcec 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2007, 2010 compeople AG and others.
+* Copyright (c) 2007, 2013 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
@@ -14,6 +14,7 @@ package org.eclipse.equinox.internal.p2.artifact.repository;
import java.io.*;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
+import java.util.zip.ZipException;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
@@ -77,6 +78,13 @@ public class SignatureVerifier extends ProcessingStep {
signedContent = verifierFactory.getSignedContent(inputFile);
} catch (GeneralSecurityException e) {
return new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, Messages.SignatureVerification_failedRead + inputFile, e);
+ } catch (ZipException e) {
+ // SignedContentFactory behavior changed to throw a ZipException if the
+ // file is not a valid zip file, before it would just return an empty unsigned content object.
+ // Here we return OK_STATUS just to keep previous behavior with the assumption that an error
+ // will be detected for the invalid artifact later.
+ // TODO is this valid?
+ return Status.OK_STATUS;
}
ArrayList<IStatus> allStatus = new ArrayList<IStatus>(0);
SignedContentEntry[] entries = signedContent.getSignedEntries();

Back to the top