454955 OSGi AnnotationParser should skip resources that are not in the classpath and close the class inputstream when done scanning it
This commit is contained in:
parent
32c27d146c
commit
8fa2c8ca60
|
@ -19,6 +19,7 @@
|
||||||
package org.eclipse.jetty.osgi.annotations;
|
package org.eclipse.jetty.osgi.annotations;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
@ -196,10 +197,21 @@ public class AnnotationParser extends org.eclipse.jetty.annotations.AnnotationPa
|
||||||
//remove the starting '/'
|
//remove the starting '/'
|
||||||
name = path.substring(1);
|
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
|
//transform into a classname to pass to the resolver
|
||||||
String shortName = name.replace('/', '.').substring(0,name.length()-6);
|
String shortName = name.replace('/', '.').substring(0,name.length()-6);
|
||||||
if ((resolver == null)|| (!resolver.isExcluded(shortName) && (!isParsed(shortName) || resolver.shouldOverride(shortName))))
|
if ((resolver == null) || (!resolver.isExcluded(shortName) && (!isParsed(shortName) || resolver.shouldOverride(shortName))))
|
||||||
scanClass(handlers, getResource(bundle), classUrl.openStream());
|
{
|
||||||
|
try (InputStream classInputStream = classUrl.openStream())
|
||||||
|
{
|
||||||
|
scanClass(handlers, getResource(bundle), classInputStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue