Fixed boot delegation wildcard matching so that it doesn't match class
names, only packages. (FELIX-1034)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@768904 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleImpl.java b/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleImpl.java
index ae5057e..2173dfc 100644
--- a/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleImpl.java
@@ -1302,25 +1302,12 @@
for (int i = 0; !result && (i < m_bootPkgs.length); i++)
{
// Check if the boot package is wildcarded.
- if (m_bootPkgWildcards[i])
+ // A wildcarded boot package will be in the form "foo.",
+ // so a matching subpackage will start with "foo.", e.g.,
+ // "foo.bar".
+ if (m_bootPkgWildcards[i] && pkgName.startsWith(m_bootPkgs[i]))
{
- // A wildcarded boot package will be in the form "foo.",
- // so a matching subpackage will start with "foo.", e.g.,
- // "foo.bar".
- if (pkgName.startsWith(m_bootPkgs[i]))
- {
- return true;
- }
- // If we have "foo." as our wildcarded boot package, then
- // the package "foo" should be delegated too, but we don't
- // want to delegate "foobar", so we check to make sure the
- // package names are the same length and then perform a
- // region match to ignore the "." on "foo.".
- else if ((pkgName.length() == m_bootPkgs[i].length() - 1)
- && pkgName.regionMatches(0, m_bootPkgs[i], 0, m_bootPkgs[i].length() - 1))
- {
- return true;
- }
+ return true;
}
// If not wildcarded, then check for an exact match.
else if (m_bootPkgs[i].equals(pkgName))