Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Bartel2014-12-12 09:32:17 -0500
committerJan Bartel2014-12-12 09:32:17 -0500
commit8fa2c8ca60797b57800714649bc73ffc4ee881d5 (patch)
tree91b2c857c395cc5a5b6f564c902c1f82336cd562 /jetty-osgi/jetty-osgi-boot/src
parent32c27d146c1597c4576de0f6f8ce1851cf8ed509 (diff)
downloadorg.eclipse.jetty.project-8fa2c8ca60797b57800714649bc73ffc4ee881d5.tar.gz
org.eclipse.jetty.project-8fa2c8ca60797b57800714649bc73ffc4ee881d5.tar.xz
org.eclipse.jetty.project-8fa2c8ca60797b57800714649bc73ffc4ee881d5.zip
454955 OSGi AnnotationParser should skip resources that are not in the classpath and close the class inputstream when done scanning it
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/AnnotationParser.java16
1 files changed, 14 insertions, 2 deletions
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);
+ }
+ }
}
}
}

Back to the top