You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "eyindanga (JIRA)" <ji...@apache.org> on 2008/11/07 10:32:46 UTC

[jira] Created: (FELIX-808) The method R4SearchPolicyCore.searchDynamicImports( IModule module, String name, String pkgName, boolean isClass) alwayls load a class by using the current thrad class loader even if the object to laod is a resource.

The method R4SearchPolicyCore.searchDynamicImports(         IModule module, String name, String pkgName, boolean isClass) alwayls load a class by using the current thrad class loader even if  the object to laod is a resource.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: FELIX-808
                 URL: https://issues.apache.org/jira/browse/FELIX-808
             Project: Felix
          Issue Type: Bug
            Reporter: eyindanga




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-808) R4SearchPolicyCore.searchDynamicImports() always loads a class even if the object to load is a resource

Posted by "Guillaume Sauthier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646900#action_12646900 ] 

Guillaume Sauthier commented on FELIX-808:
------------------------------------------

:)

In fact, we found that issue when Felix is run on Windows.
JacORB tries to load a configuration file using different strategies:
1. use the TCCL.getResource()
2. if not found, tries the absolute filename

The problem is that the resource it tries to load from the TCCL is already the absolute file name (ie, under windows something like 'd:\path\to\my\resource').
So the call looks like this :
Thread.currentThread().getContextClassLoader().getResource("d:\path\to\my\resource");
The TCCL is a bundle ClassLoader of Felix with a 'DynamicImport-Packages *'.

This is where we fallback on the system classloader (not 100% sure) and we try to load d:\...\resource as a class (changing all . to / and adding a .class suffix :) ).


> R4SearchPolicyCore.searchDynamicImports() always loads a class even if the object to load is a resource
> -------------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-808
>                 URL: https://issues.apache.org/jira/browse/FELIX-808
>             Project: Felix
>          Issue Type: Bug
>    Affects Versions: felix-1.4.0
>            Reporter: eyindanga
>            Assignee: Richard S. Hall
>             Fix For: felix-1.4.1
>
>
> The method R4SearchPolicyCore.searchDynamicImports( IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if  the object to laod is a resource.
> This code may chek if the object is a class or a resource, and invoke the coresponding method on the classloader.
>                // If there are no bundles providing exports for this
>                 // package and if the instigating class was not from a
>                 // bundle, then delegate to the parent class loader.
>                 // Otherwise, break out of loop and return null.
>                 boolean delegate = true;
>                 for (ClassLoader cl = classes[i].getClassLoader(); cl != null; cl = cl.getClass().getClassLoader())
>                 {
>                     if (ContentClassLoader.class.isInstance(cl))
>                     {
>                         delegate = false;
>                         break;
>                     }
>                 }
>                 if (delegate)
>                 {
>                     return this.getClass().getClassLoader().loadClass(name);
>                 }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-808) The method R4SearchPolicyCore.searchDynamicImports( IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if the object to load is a resource.

Posted by "eyindanga (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

eyindanga updated FELIX-808:
----------------------------

    Description: 
The method R4SearchPolicyCore.searchDynamicImports( IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if  the object to laod is a resource.

This code may chek if the object is a class or a resource, and invoke the coresponding method on the classloader.

               // If there are no bundles providing exports for this
                // package and if the instigating class was not from a
                // bundle, then delegate to the parent class loader.
                // Otherwise, break out of loop and return null.
                boolean delegate = true;
                for (ClassLoader cl = classes[i].getClassLoader(); cl != null; cl = cl.getClass().getClassLoader())
                {
                    if (ContentClassLoader.class.isInstance(cl))
                    {
                        delegate = false;
                        break;
                    }
                }
                if (delegate)
                {
                    return this.getClass().getClassLoader().loadClass(name);
                }


        Summary: The method R4SearchPolicyCore.searchDynamicImports(         IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if  the object to load is a resource.  (was: The method R4SearchPolicyCore.searchDynamicImports(         IModule module, String name, String pkgName, boolean isClass) alwayls load a class by using the current thrad class loader even if  the object to laod is a resource.)

> The method R4SearchPolicyCore.searchDynamicImports(         IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if  the object to load is a resource.
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-808
>                 URL: https://issues.apache.org/jira/browse/FELIX-808
>             Project: Felix
>          Issue Type: Bug
>            Reporter: eyindanga
>
> The method R4SearchPolicyCore.searchDynamicImports( IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if  the object to laod is a resource.
> This code may chek if the object is a class or a resource, and invoke the coresponding method on the classloader.
>                // If there are no bundles providing exports for this
>                 // package and if the instigating class was not from a
>                 // bundle, then delegate to the parent class loader.
>                 // Otherwise, break out of loop and return null.
>                 boolean delegate = true;
>                 for (ClassLoader cl = classes[i].getClassLoader(); cl != null; cl = cl.getClass().getClassLoader())
>                 {
>                     if (ContentClassLoader.class.isInstance(cl))
>                     {
>                         delegate = false;
>                         break;
>                     }
>                 }
>                 if (delegate)
>                 {
>                     return this.getClass().getClassLoader().loadClass(name);
>                 }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-808) R4SearchPolicyCore.searchDynamicImports() always loads a class even if the object to load is a resource

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard S. Hall updated FELIX-808:
----------------------------------

    Fix Version/s: felix-1.4.1

> R4SearchPolicyCore.searchDynamicImports() always loads a class even if the object to load is a resource
> -------------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-808
>                 URL: https://issues.apache.org/jira/browse/FELIX-808
>             Project: Felix
>          Issue Type: Bug
>    Affects Versions: felix-1.4.0
>            Reporter: eyindanga
>            Assignee: Richard S. Hall
>             Fix For: felix-1.4.1
>
>
> The method R4SearchPolicyCore.searchDynamicImports( IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if  the object to laod is a resource.
> This code may chek if the object is a class or a resource, and invoke the coresponding method on the classloader.
>                // If there are no bundles providing exports for this
>                 // package and if the instigating class was not from a
>                 // bundle, then delegate to the parent class loader.
>                 // Otherwise, break out of loop and return null.
>                 boolean delegate = true;
>                 for (ClassLoader cl = classes[i].getClassLoader(); cl != null; cl = cl.getClass().getClassLoader())
>                 {
>                     if (ContentClassLoader.class.isInstance(cl))
>                     {
>                         delegate = false;
>                         break;
>                     }
>                 }
>                 if (delegate)
>                 {
>                     return this.getClass().getClassLoader().loadClass(name);
>                 }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (FELIX-808) The method R4SearchPolicyCore.searchDynamicImports( IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if the object to load is a resource.

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard S. Hall resolved FELIX-808.
-----------------------------------

    Resolution: Fixed

I committed a fix for this in the trunk. If you can build the trunk and test it, that would be great, then you could close this issue for us. I wonder how you found this bug, since it is definitely not something you should run into too much...it is completely non-spec behavior. :-)

> The method R4SearchPolicyCore.searchDynamicImports(         IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if  the object to load is a resource.
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-808
>                 URL: https://issues.apache.org/jira/browse/FELIX-808
>             Project: Felix
>          Issue Type: Bug
>    Affects Versions: felix-1.4.0
>            Reporter: eyindanga
>
> The method R4SearchPolicyCore.searchDynamicImports( IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if  the object to laod is a resource.
> This code may chek if the object is a class or a resource, and invoke the coresponding method on the classloader.
>                // If there are no bundles providing exports for this
>                 // package and if the instigating class was not from a
>                 // bundle, then delegate to the parent class loader.
>                 // Otherwise, break out of loop and return null.
>                 boolean delegate = true;
>                 for (ClassLoader cl = classes[i].getClassLoader(); cl != null; cl = cl.getClass().getClassLoader())
>                 {
>                     if (ContentClassLoader.class.isInstance(cl))
>                     {
>                         delegate = false;
>                         break;
>                     }
>                 }
>                 if (delegate)
>                 {
>                     return this.getClass().getClassLoader().loadClass(name);
>                 }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-808) R4SearchPolicyCore.searchDynamicImports() always loads a class even if the object to load is a resource

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard S. Hall updated FELIX-808:
----------------------------------

    Affects Version/s: felix-1.4.0
              Summary: R4SearchPolicyCore.searchDynamicImports() always loads a class even if the object to load is a resource  (was: The method R4SearchPolicyCore.searchDynamicImports(         IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if  the object to load is a resource.)

> R4SearchPolicyCore.searchDynamicImports() always loads a class even if the object to load is a resource
> -------------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-808
>                 URL: https://issues.apache.org/jira/browse/FELIX-808
>             Project: Felix
>          Issue Type: Bug
>    Affects Versions: felix-1.4.0
>            Reporter: eyindanga
>            Assignee: Richard S. Hall
>
> The method R4SearchPolicyCore.searchDynamicImports( IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if  the object to laod is a resource.
> This code may chek if the object is a class or a resource, and invoke the coresponding method on the classloader.
>                // If there are no bundles providing exports for this
>                 // package and if the instigating class was not from a
>                 // bundle, then delegate to the parent class loader.
>                 // Otherwise, break out of loop and return null.
>                 boolean delegate = true;
>                 for (ClassLoader cl = classes[i].getClassLoader(); cl != null; cl = cl.getClass().getClassLoader())
>                 {
>                     if (ContentClassLoader.class.isInstance(cl))
>                     {
>                         delegate = false;
>                         break;
>                     }
>                 }
>                 if (delegate)
>                 {
>                     return this.getClass().getClassLoader().loadClass(name);
>                 }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (FELIX-808) The method R4SearchPolicyCore.searchDynamicImports( IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if the object to load is a resource.

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard S. Hall reassigned FELIX-808:
-------------------------------------

    Assignee: Richard S. Hall

> The method R4SearchPolicyCore.searchDynamicImports(         IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if  the object to load is a resource.
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-808
>                 URL: https://issues.apache.org/jira/browse/FELIX-808
>             Project: Felix
>          Issue Type: Bug
>    Affects Versions: felix-1.4.0
>            Reporter: eyindanga
>            Assignee: Richard S. Hall
>
> The method R4SearchPolicyCore.searchDynamicImports( IModule module, String name, String pkgName, boolean isClass) always load a class by using the current thrad class loader even if  the object to laod is a resource.
> This code may chek if the object is a class or a resource, and invoke the coresponding method on the classloader.
>                // If there are no bundles providing exports for this
>                 // package and if the instigating class was not from a
>                 // bundle, then delegate to the parent class loader.
>                 // Otherwise, break out of loop and return null.
>                 boolean delegate = true;
>                 for (ClassLoader cl = classes[i].getClassLoader(); cl != null; cl = cl.getClass().getClassLoader())
>                 {
>                     if (ContentClassLoader.class.isInstance(cl))
>                     {
>                         delegate = false;
>                         break;
>                     }
>                 }
>                 if (delegate)
>                 {
>                     return this.getClass().getClassLoader().loadClass(name);
>                 }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.