Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone Bordet2014-12-22 15:32:09 -0500
committerSimone Bordet2014-12-22 15:32:09 -0500
commite8c88cfd9cf3cab89788cd530838314089ce9b23 (patch)
treec14617e47e347abbd4a83112d65caaab41adb806 /jetty-osgi/jetty-osgi-boot/src
parenta71cc6978ae9f25fb378813044c9415944eb3b74 (diff)
parentfc42d5d4aaf4a2b48e2f80a3f098bfe3b145ef7c (diff)
downloadorg.eclipse.jetty.project-e8c88cfd9cf3cab89788cd530838314089ce9b23.tar.gz
org.eclipse.jetty.project-e8c88cfd9cf3cab89788cd530838314089ce9b23.tar.xz
org.eclipse.jetty.project-e8c88cfd9cf3cab89788cd530838314089ce9b23.zip
Merged branch 'jetty-9.2.x' into 'master'.
Diffstat (limited to 'jetty-osgi/jetty-osgi-boot/src')
-rw-r--r--jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationConfiguration.java8
-rw-r--r--jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationParser.java16
-rw-r--r--jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractWebAppProvider.java4
-rw-r--r--jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/BundleContextProvider.java2
-rw-r--r--jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiWebInfConfiguration.java4
-rw-r--r--jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/DefaultJettyAtJettyHomeHelper.java3
6 files changed, 32 insertions, 5 deletions
diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationConfiguration.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationConfiguration.java
index 254a853892..08eca6c2b8 100644
--- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationConfiguration.java
+++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationConfiguration.java
@@ -103,6 +103,10 @@ public class AnnotationConfiguration extends org.eclipse.jetty.annotations.Annot
//index and scan fragments
for (Bundle bundle : fragAndRequiredBundles)
{
+ //skip bundles that have been uninstalled since we discovered them
+ if (bundle.getState() == Bundle.UNINSTALLED)
+ continue;
+
Resource bundleRes = oparser.indexBundle(bundle);
if (!context.getMetaData().getWebInfJars().contains(bundleRes))
{
@@ -127,6 +131,10 @@ public class AnnotationConfiguration extends org.eclipse.jetty.annotations.Annot
//scan the required bundles
for (Bundle requiredBundle : fragAndRequiredBundles)
{
+ //skip bundles that have been uninstalled since we discovered them
+ if (requiredBundle.getState() == Bundle.UNINSTALLED)
+ continue;
+
if (requiredBundle.getHeaders().get(Constants.FRAGMENT_HOST) == null)
{
//a bundle indeed:
diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationParser.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationParser.java
index 549542be06..f841071325 100644
--- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationParser.java
+++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/annotations/AnnotationParser.java
@@ -19,6 +19,7 @@
package org.eclipse.jetty.osgi.annotations;
import java.io.File;
+import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.util.Comparator;
@@ -196,10 +197,21 @@ public class AnnotationParser extends org.eclipse.jetty.annotations.AnnotationPa
//remove the starting '/'
name = path.substring(1);
}
+ if (name == null)
+ {
+ //found some .class file in the archive that was not under one of the prefix paths
+ //or the bundle classpath wasn't simply ".", so skip it
+ continue;
+ }
//transform into a classname to pass to the resolver
String shortName = name.replace('/', '.').substring(0,name.length()-6);
- if ((resolver == null)|| (!resolver.isExcluded(shortName) && (!isParsed(shortName) || resolver.shouldOverride(shortName))))
- scanClass(handlers, getResource(bundle), classUrl.openStream());
+ if ((resolver == null) || (!resolver.isExcluded(shortName) && (!isParsed(shortName) || resolver.shouldOverride(shortName))))
+ {
+ try (InputStream classInputStream = classUrl.openStream())
+ {
+ scanClass(handlers, getResource(bundle), classInputStream);
+ }
+ }
}
}
}
diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractWebAppProvider.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractWebAppProvider.java
index 28f72c814f..030ac00588 100644
--- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractWebAppProvider.java
+++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/AbstractWebAppProvider.java
@@ -403,7 +403,7 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
throw new IllegalStateException("Unable to get PackageAdmin reference to locate required Tld bundles");
StringBuilder paths = new StringBuilder();
- String[] symbNames = requireTldBundles.split(", ");
+ String[] symbNames = requireTldBundles.split("[, ]");
for (String symbName : symbNames)
{
@@ -452,7 +452,7 @@ public abstract class AbstractWebAppProvider extends AbstractLifeCycle implement
String tmp = (String)_properties.get(OSGiWebappConstants.JETTY_CONTEXT_FILE_PATH);
if (tmp != null)
{
- String[] filenames = tmp.split(",;");
+ String[] filenames = tmp.split("[,;]");
if (filenames != null && filenames.length > 0)
{
String filename = filenames[0]; //should only be 1 filename in this usage
diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/BundleContextProvider.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/BundleContextProvider.java
index 65466f506a..6b72ffd48a 100644
--- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/BundleContextProvider.java
+++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/BundleContextProvider.java
@@ -125,7 +125,7 @@ public class BundleContextProvider extends AbstractContextProvider implements Bu
//bundle defines JETTY_CONTEXT_FILE_PATH header,
//a comma separated list of context xml files that each define a ContextHandler
//TODO: (could be WebAppContexts)
- String[] tmp = contextFiles.split(",;");
+ String[] tmp = contextFiles.split("[,;]");
for (String contextFile : tmp)
{
String originId = bundle.getSymbolicName() + "-" + bundle.getVersion().toString() + "-"+contextFile;
diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiWebInfConfiguration.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiWebInfConfiguration.java
index b453724919..697ebd66d8 100644
--- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiWebInfConfiguration.java
+++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/OSGiWebInfConfiguration.java
@@ -177,6 +177,10 @@ public class OSGiWebInfConfiguration extends WebInfConfiguration
for (Bundle b : bundles)
{
+ //skip bundles that are not installed
+ if (b.getState() == Bundle.UNINSTALLED)
+ continue;
+
//add to context attribute storing associated fragments and required bundles
fragsAndReqsBundles.add(b);
File f = BundleFileLocatorHelperFactory.getFactory().getHelper().getBundleInstallLocation(b);
diff --git a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/DefaultJettyAtJettyHomeHelper.java b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/DefaultJettyAtJettyHomeHelper.java
index 1347c65563..5acb688fad 100644
--- a/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/DefaultJettyAtJettyHomeHelper.java
+++ b/jetty-osgi/jetty-osgi-boot/src/main/java/org/eclipse/jetty/osgi/boot/internal/serverfactory/DefaultJettyAtJettyHomeHelper.java
@@ -128,6 +128,9 @@ public class DefaultJettyAtJettyHomeHelper
jettyHomeBundleSysProp = Util.resolvePropertyValue(jettyHomeBundleSysProp);
for (Bundle b : bundleContext.getBundles())
{
+ if (b.getState() == Bundle.UNINSTALLED)
+ continue;
+
if (b.getSymbolicName().equals(jettyHomeBundleSysProp))
{
jettyHomeBundle = b;

Back to the top