diff options
author | David Williams | 2016-02-18 04:10:24 +0000 |
---|---|---|
committer | Thomas Watson | 2016-02-18 14:19:16 +0000 |
commit | 0d49b920587d8a11fd4db5009a243808ab323945 (patch) | |
tree | 9a80eff264ec44b42081fd33c90da605378f030c | |
parent | b56fb6c8cab11946c5aab9ac981f3182bbab6455 (diff) | |
download | rt.equinox.framework-0d49b920587d8a11fd4db5009a243808ab323945.tar.gz rt.equinox.framework-0d49b920587d8a11fd4db5009a243808ab323945.tar.xz rt.equinox.framework-0d49b920587d8a11fd4db5009a243808ab323945.zip |
Bug 487954 - SignedBundleHook.getSignedContent() should report path
My guess is the "root" problem is in the JRE, but since they are deep in
native methods, they may know the "file name" at the point the error
occurs. But, we do, so I propose to catch the ZipException, and
supplement it with the path information, and then re-throw it. I think
that minimizes risk of effecting other code paths.
Change-Id: Ieaf0072bb06f8be541a52cc24e35c38a82985e27
Signed-off-by: David Williams <david_williams@us.ibm.com>
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r-- | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java index 45ea87b0d..ce648ea4a 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2013 IBM Corporation and others. + * Copyright (c) 2006, 2016 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 @@ -21,6 +21,7 @@ import java.security.cert.CertificateException; import java.util.*; import java.util.zip.ZipFile; import org.eclipse.osgi.framework.log.FrameworkLogEntry; +import org.eclipse.osgi.framework.util.SecureAction; import org.eclipse.osgi.internal.framework.EquinoxBundle; import org.eclipse.osgi.internal.framework.EquinoxContainer; import org.eclipse.osgi.internal.hookregistry.*; @@ -40,6 +41,7 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer; * Implements signed bundle hook support for the framework */ public class SignedBundleHook implements ActivatorHookFactory, BundleFileWrapperFactoryHook, HookConfigurator, SignedContentFactory { + static final SecureAction secureAction = AccessController.doPrivileged(SecureAction.createSecureAction()); static final int VERIFY_CERTIFICATE = 0x01; static final int VERIFY_TRUST = 0x02; static final int VERIFY_RUNTIME = 0x04; @@ -205,8 +207,9 @@ public class SignedBundleHook implements ActivatorHookFactory, BundleFileWrapper if (content.isDirectory()) { contentBundleFile = new DirBundleFile(content, false); } else { - // make sure we have a ZipFile first, this will throw an IOException if not valid - ZipFile temp = new ZipFile(content); + // Make sure we have a ZipFile first, this will throw an IOException if not valid. + // Use SecureAction because it gives better errors about the path on exceptions + ZipFile temp = secureAction.getZipFile(content); temp.close(); contentBundleFile = new ZipBundleFile(content, null, null, container.getConfiguration().getDebug()); } |