Closed
Description
Describe the bug
Even after fixing service loader related issues (#630) services are not loaded in an OSGi environment.
To Reproduce
Steps to reproduce the behavior:
- Use patched jar(s)
- Attempt to connect to imap provider.
Expected behavior
Service with class name obtained from provider should load.
Cause of problem
In an OSGi environment, the provider (obtained e.g. from imap.jar) has its own (bundle) classloader. This classloader is never tried when getting the service.
The code attempts loading with the context classloader and either the Session's classloader or -- if given -- the authenticator's classloader (why?). But the obvious option, using the classloader that loaded the provider, is not used.
What's missing is an attempt like:
try {
serviceClass = Class.forName(provider.getClassName(), false,
provider.getClass().getClassLoader());
} catch (ClassNotFoundException ex) {
// ignore it
}
Metadata
Metadata
Assignees
Labels
No labels