You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Wolfgang Glas (JIRA)" <ji...@apache.org> on 2011/01/15 12:27:45 UTC
[jira] Created: (OPENJPA-1924) BundleUtils.getBundleClassLoader()
is utterly complicated.
BundleUtils.getBundleClassLoader() is utterly complicated.
----------------------------------------------------------
Key: OPENJPA-1924
URL: https://issues.apache.org/jira/browse/OPENJPA-1924
Project: OpenJPA
Issue Type: Improvement
Components: osgi
Affects Versions: 2.0.1
Environment: apache-karaf-2.1.2, openjdk-1.6.0b18
Reporter: Wolfgang Glas
Priority: Minor
I reviewed the code in
org.apache.openjpa.persistence.osgi
and could not find a point, why the code in BundleUtils.getBundleClassLoader() uses yet-another implmementation of a class loader (BundleDelegatingClassLoader) in order to acces the class laoder of the openjpa bundle.
IMHO, BundleUtils.getBundleClassLoader() should simply read
public static ClassLoader getBundleClassLoader() {
if (runningUnderOSGi()) {
return BundleUtils.class.getClassLoader();
}
else {
return null;
}
}
rendering the BundleDelegatindClassLoader class and the PersistenceActivator.getBundleClassLoader() method useless.
Rationale: BundleUtils is a class, that lives inside the openjpa bundle and therefore has been loaded by the OSGi framework using a class loader, which knows the bundle's class and furthermore delegates to the imported packages from other bundles or the OSGi framework, aka the bundle class loader.
Simplifying the code like suggested is not a big leap, but it helps to keep the code small and readable ;-)
Best regards,
Wolfgang
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.