felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard S. Hall" <he...@ungoverned.org>
Subject Re: Bug in Bundle.getEntry ?
Date Tue, 19 Sep 2006 16:21:11 GMT
The patch appears to not have been attached to the message...

Better yet, perhaps you could create a JIRA issue for this on the 
framework component and attach the patch to it.

    http://issues.apache.org/jira/browse/Felix

Thanks.

-> richard



Olivier Gruber wrote:
>
> I think I found a bug in the implementation of URL 
> Bundle.getEntry(String name);
> It raises a ClassCastException when called on the system bundle since 
> its content loader
> is not a ContentLoaderImpl but actually a SystemBundleContentLoader. :-(
>
> *class BundleImpl        *
> *    public* URL getEntry(String name)
>     {
>         Object sm = System./getSecurityManager/();
>
>         *if* (sm != *null*)
>         {
>             *try*
>             {
>                 ((SecurityManager) sm).checkPermission(*new* 
> AdminPermission(*this*,
>                     AdminPermission./RESOURCE/));
>             }
>             *catch* (Exception e)
>             {
>                 *return* *null*; // No permission
>             }
>         }
>
>         *return* m_felix.getBundleEntry(*this*, name);
>     }
>
> *class Felix*
>     /**
>      * Implementation for Bundle.getEntry().
>     **/
>     *protected* URL getBundleEntry(BundleImpl bundle, String name)
>     {
>         *if* (bundle.getInfo().getState() == Bundle./UNINSTALLED/)
>         {
>             *throw* *new* IllegalStateException("The bundle is 
> uninstalled.");
>         }
> ==>>        *return* ((ContentLoaderImpl) 
> bundle.getInfo().getCurrentModule()
>             .getContentLoader()).getResourceFromContent(name);
>     }
>
> Here is a patch for this problem.
>
>        
>
> It is basically moving the getResourceFromContent from 
> ContentLoaderImpl to Felix,
> which required to modify the FindEntriesEnumeration slightly.
>
> Best regards,
>
> Olivier Gruber, Ph.D.
> Persistent & Distributed Object Platforms and Frameworks
> IBM TJ Watson Research Center
>

Mime
View raw message