Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2016-03-03 20:15:05 +0000
committerJohn Ross2016-03-03 20:44:45 +0000
commitd2e12471494d0dd3721261510cff0b5b4d391754 (patch)
tree9283bbc2c69c98ab344e5f80f7b5358f440deaab /bundles/org.eclipse.osgi
parent121b7c5b2cb5f7a130720d382a3eac8c0e290a05 (diff)
downloadrt.equinox.framework-d2e12471494d0dd3721261510cff0b5b4d391754.tar.gz
rt.equinox.framework-d2e12471494d0dd3721261510cff0b5b4d391754.tar.xz
rt.equinox.framework-d2e12471494d0dd3721261510cff0b5b4d391754.zip
[Bug 477787] Embedded Equinox in an entreprise application ear - NullPointerException at start upI20160308-0800
In BundleInfo.Generation, check for null content and, if so, set lastModified to zero. In ModuleClassLoader, check for a null base file from BundleFile and, if so, create the ProtectionDomain with a null CodeSource. In both cases, the referenced variable will be null when the osgi.framework property was specified with an invalid value. Plus test. Signed-off-by: John Ross <jwross@us.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.osgi')
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java5
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java5
2 files changed, 9 insertions, 1 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java
index 7593c3006..199599389 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java
@@ -11,6 +11,7 @@
package org.eclipse.osgi.internal.loader;
+import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
@@ -357,7 +358,9 @@ public abstract class ModuleClassLoader extends ClassLoader implements BundleRef
if (signers.length > 0)
certs = signers[0].getCertificateChain();
}
- return new GenerationProtectionDomain(new CodeSource(bundlefile.getBaseFile().toURL(), certs), permissions, getGeneration());
+ File file = bundlefile.getBaseFile();
+ // Bug 477787: file will be null when the osgi.framework configuration property contains an invalid value.
+ return new GenerationProtectionDomain(file == null ? null : new CodeSource(file.toURL(), certs), permissions, getGeneration());
//return new ProtectionDomain(new CodeSource(bundlefile.getBaseFile().toURL(), certs), permissions);
} catch (MalformedURLException e) {
// Failed to create our own domain; just return the baseDomain
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java
index e04e6d29f..4ab00f0aa 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java
@@ -192,6 +192,11 @@ public final class BundleInfo {
}
private void setLastModified(File content) {
+ if (content == null) {
+ // Bug 477787: content will be null when the osgi.framework configuration property contains an invalid value.
+ lastModified = 0;
+ return;
+ }
if (isDirectory)
content = new File(content, "META-INF/MANIFEST.MF"); //$NON-NLS-1$
lastModified = Storage.secureAction.lastModified(content);

Back to the top