Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2011-11-11 14:16:07 +0000
committerThomas Watson2011-11-11 14:16:07 +0000
commit15c407a628c04a4424fae479f85259e78d7cc892 (patch)
treea827d995bc55785cce7eeb6cd89d786c25212201
parente09b8b1b24979cd5e704da75fbfb85dbe831e00f (diff)
downloadrt.equinox.framework-15c407a628c04a4424fae479f85259e78d7cc892.tar.gz
rt.equinox.framework-15c407a628c04a4424fae479f85259e78d7cc892.tar.xz
rt.equinox.framework-15c407a628c04a4424fae479f85259e78d7cc892.zip
Bug 363528 - IOExceptions while reading class bytes should not be
swallowed/ignored
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java29
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/loader/ClasspathManager.java2
2 files changed, 29 insertions, 2 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java
index e396222ae..95c64a2f5 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/security/SignedBundleTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2011 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
@@ -376,6 +376,33 @@ public class SignedBundleTest extends BaseSecurityTest {
}
}
+ public void testSignedContent07a() {
+ Bundle testBundle = null;
+ try {
+ testBundle = installBundle(getTestJarPath("signed_with_corrupt"));
+
+ // Loading a corrupt class will cause a LinkageError
+ testBundle.loadClass("org.eclipse.equinox.security.junit.CorruptClass");
+
+ } catch (LinkageError error) {
+ // will happen if not running with runtime checks
+ if ("all".equals(System.getProperty("osgi.signedcontent.support"))) {
+ // if signed content support is enabled then the cause is an InvalidContentException
+ Throwable t = error.getCause();
+ assertTrue("Cause is the wrong type: " + t, t instanceof InvalidContentException);
+ }
+ } catch (Exception e) {
+
+ fail("Unexpected exception", e);
+ } finally {
+ try {
+ testBundle.uninstall();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ }
+
// positve 1 signer, 1 tsa
public void testSignedContent08() {
Bundle testBundle = null;
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/loader/ClasspathManager.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/loader/ClasspathManager.java
index 2a3d0b271..4173da25e 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/loader/ClasspathManager.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/loader/ClasspathManager.java
@@ -543,7 +543,7 @@ public class ClasspathManager {
} catch (IOException e) {
if (Debug.DEBUG_LOADER)
Debug.println(" IOException reading " + filename + " from " + classpathEntry.getBundleFile()); //$NON-NLS-1$ //$NON-NLS-2$
- return null;
+ throw (LinkageError) new LinkageError("Error reading class bytes: " + name).initCause(e); //$NON-NLS-1$
}
if (Debug.DEBUG_LOADER) {
Debug.println(" read " + classbytes.length + " bytes from " + classpathEntry.getBundleFile() + "/" + filename); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

Back to the top