You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by tj...@apache.org on 2022/06/29 13:42:52 UTC

[felix-atomos] branch master updated: Issue 60 - correctly delegate to platform for modules with no class loader

This is an automated email from the ASF dual-hosted git repository.

tjwatson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-atomos.git


The following commit(s) were added to refs/heads/master by this push:
     new 37b19b6  Issue 60 - correctly delegate to platform for modules with no class loader
     new 331939b  Merge pull request #61 from tjwatson/issue60
37b19b6 is described below

commit 37b19b6649d3b9ceeec3d0085f116a41c0af4230
Author: Thomas Watson <tj...@us.ibm.com>
AuthorDate: Thu Jun 23 14:17:16 2022 -0500

    Issue 60 - correctly delegate to platform for modules with no class loader
    
    It seems Module.getClassLoader will return null for boot layer class loaders
    We need to just use the platform loader in this case to do proper delegation
    
    If we don't do this the framework will use the Atomos content that wraps
    the module content as the source for creating a bundle class loader.
---
 .../org/apache/felix/atomos/impl/modules/ConnectContentModule.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/atomos/src/main/java/org/apache/felix/atomos/impl/modules/ConnectContentModule.java b/atomos/src/main/java/org/apache/felix/atomos/impl/modules/ConnectContentModule.java
index aafaf6c..da389b1 100644
--- a/atomos/src/main/java/org/apache/felix/atomos/impl/modules/ConnectContentModule.java
+++ b/atomos/src/main/java/org/apache/felix/atomos/impl/modules/ConnectContentModule.java
@@ -27,6 +27,7 @@ import org.osgi.framework.connect.ConnectContent;
 
 public class ConnectContentModule implements ConnectContent
 {
+	static final ClassLoader platformLoader = ClassLoader.getPlatformClassLoader();
     final Module module;
     final ModuleReference reference;
     final AtomosLayerModules atomosLayer;
@@ -61,7 +62,7 @@ public class ConnectContentModule implements ConnectContent
     @Override
     public Optional<ClassLoader> getClassLoader()
     {
-        return Optional.ofNullable(module.getClassLoader());
+        return Optional.ofNullable(module.getClassLoader()).or(() -> Optional.of(ConnectContentModule.platformLoader));
     }
 
     @Override