[ 
https://issues.apache.org/jira/browse/FELIX-934?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Koszegi reopened FELIX-934:
----------------------------------


I tested the solution on 1.4.1 and it is not a 100% fix. 

The condition pkgName.regionMatches(0, m_bootPkgs[i], 0, m_bootPkgs[i].length() 
- 1))) will pass for any javax.pakagename because java. is always in the 
bootdelegation array - the result is that all javax packages will be 
bootdelegated, but they should not. 

The correct condition in my opinion is:
pkgName.regionMatches(0, m_bootPkgs[i], 0, m_bootPkgs[i].length())))  

The -1 in the length calculation excluded the trailing period allowing unwanted 
matches.

This is true for explicitly defined bootdelegations as well : if com.foo.* is 
bootdelegated then com.foobar will be as well.

Regards,
Robert

> Bootdelegation bug
> ------------------
>
>                 Key: FELIX-934
>                 URL: https://issues.apache.org/jira/browse/FELIX-934
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-1.4.1
>         Environment: All
>            Reporter: Robert Koszegi
>            Assignee: Richard S. Hall
>             Fix For: felix-1.6.0
>
>
> Bootdelegation does not work as supposed in 1.4.1
> Let's say I provide the following parameter at startup 
> org.osgi.framework.bootdelegation=org.acme.foo.bar.*
> Then the class org.acme.foo.bar.ClassA should be loaded by the boot 
> classloader meanwhile org.acme.foo.ClassB should not, however currently both 
> classes will be loaded by the boot classloader.
> This is due to a bug in R4SearchPolicyCore with checking if the 
> bootdelegation should be applied for a given package:
> if ((m_bootPkgWildcards[i] &&
>                     (pkgName.startsWith(m_bootPkgs[i]) ||
>                     m_bootPkgs[i].regionMatches(0, pkgName, 0, 
> pkgName.length())))
>                     || (!m_bootPkgWildcards[i] && 
> m_bootPkgs[i].equals(pkgName))) 
> That is  m_bootPkgs[i].regionMatches(0, pkgName, 0, pkgName.length()) will 
> pass for org.acme.foo if the bootdelegation is set for org.acme.foo.bar.* - 
> but it should not!
> Regards,
> Robert

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to