Felix Meschberger wrote:
Hi,

I play around with class loaders a bit and stumbled upon the following
issue: Bundle.loadClass is implemented internally by the
Felix.loadBundleClass method. This method in turn delegates to current
module of the bundle to get the class. If the module returns null, i.e.
cannot find the class, a ClassNotFoundException is thrown as expected. In
addition a FrameworkEvent.ERROR is fired.

According to the comment, the FrameworkEvent.ERROR is required by the spec.
I understand the spec in the sense, that the FrameworkEvent.ERROR is
required if the bundle needs to be resolved and resolving the bundle fails.
So in the case of a resolved bundle not finding the class, a
FrameworkEvent.ERROR is not fired.

On the other hand, the R4SearchPolicyCore.findClassOrResource method called
to find the class or resource checks and resolves the bundle and simply
throws a ClassNotFoundException. Probably, the FrameworkEvent.ERROR should
be thrown here ?

What do you think ?

I don't really agree. The main reasons being that currently R4SearchPolicyCore does not have a reference to Felix at all, thus we would have to introduce a new dependency there and then we would have to expose the event firing method as public, which it currently is not.

-> richard

Reply via email to