You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Ali Naddaf (JIRA)" <ji...@apache.org> on 2008/11/03 14:19:44 UTC

[jira] Created: (FELIX-800) URLHandlersBundleStreamHandler.openConnection(URL) fails when extending Felix

URLHandlersBundleStreamHandler.openConnection(URL) fails when extending Felix
-----------------------------------------------------------------------------

                 Key: FELIX-800
                 URL: https://issues.apache.org/jira/browse/FELIX-800
             Project: Felix
          Issue Type: Bug
          Components: Felix Commons
            Reporter: Ali Naddaf


I am seeing an exception in the URLHandlersBundleStreamHandler.openConnection(URL) method. Here is the part I am referring to:

if (framework != null)
       {
           // TODO: optimize this to not use reflection if not needed
           try
           {
               Class targetClass = framework.getClass().getClassLoader().loadClass(
                   URLHandlersBundleURLConnection.class.getName());
                             return (URLConnection) m_action.invoke(m_action.getConstructor(targetClass,
                   new Class[]{URL.class, framework.getClass()}),
                   new Object[]{url, framework});
           }
           catch (Exception ex)
           {
               throw new IOException(ex.getMessage());
           }
       }
       throw new IOException("No framework context found");

The problem happens when reflection fails to find the appropriate constructor and throws a NoSuchMethodException; here the targetClass resolves to "org.apache.felix.framework.URLHandlersBundleURLConnection" and
the exception is:

java.lang.NoSuchMethodException: org.apache.felix.framework.URLHandlersBundleURLConnection.<init>(java.net.URL, org.simplecenter.application.SimpleCenterApplication)

Note that SimpleCenterApplicaion extends Felix and  URLHandlersBundleURLConnection has the constructor URLHandlersBundleURLConnection(URL, Felix). 

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


[jira] Resolved: (FELIX-800) URLHandlersBundleStreamHandler.openConnection(URL) fails when extending Felix

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

Karl Pauls resolved FELIX-800.
------------------------------

    Resolution: Fixed

Should be fixed in trunk and the upcoming 1.4.0 release. Please test it and close this issue if it works for you.

> URLHandlersBundleStreamHandler.openConnection(URL) fails when extending Felix
> -----------------------------------------------------------------------------
>
>                 Key: FELIX-800
>                 URL: https://issues.apache.org/jira/browse/FELIX-800
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-1.0.4, felix-1.2.0, felix-1.2.1
, felix-1.2.2
>            Reporter: Ali Naddaf
>            Assignee: Karl Pauls
>            Priority: Minor
>             Fix For: felix-1.4.0
>
>
> I am seeing an exception in the URLHandlersBundleStreamHandler.openConnection(URL) method. Here is the part I am referring to:
> if (framework != null)
>        {
>            // TODO: optimize this to not use reflection if not needed
>            try
>            {
>                Class targetClass = framework.getClass().getClassLoader().loadClass(
>                    URLHandlersBundleURLConnection.class.getName());
>                              return (URLConnection) m_action.invoke(m_action.getConstructor(targetClass,
>                    new Class[]{URL.class, framework.getClass()}),
>                    new Object[]{url, framework});
>            }
>            catch (Exception ex)
>            {
>                throw new IOException(ex.getMessage());
>            }
>        }
>        throw new IOException("No framework context found");
> The problem happens when reflection fails to find the appropriate constructor and throws a NoSuchMethodException; here the targetClass resolves to "org.apache.felix.framework.URLHandlersBundleURLConnection" and
> the exception is:
> java.lang.NoSuchMethodException: org.apache.felix.framework.URLHandlersBundleURLConnection.<init>(java.net.URL, org.simplecenter.application.SimpleCenterApplication)
> Note that SimpleCenterApplicaion extends Felix and  URLHandlersBundleURLConnection has the constructor URLHandlersBundleURLConnection(URL, Felix). 

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


[jira] Closed: (FELIX-800) URLHandlersBundleStreamHandler.openConnection(URL) fails when extending Felix

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

Ali Naddaf closed FELIX-800.
----------------------------


I tested the fix in the trunk and worked perfectly fine, thank you Karl.

> URLHandlersBundleStreamHandler.openConnection(URL) fails when extending Felix
> -----------------------------------------------------------------------------
>
>                 Key: FELIX-800
>                 URL: https://issues.apache.org/jira/browse/FELIX-800
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-1.0.4, felix-1.2.0, felix-1.2.1
, felix-1.2.2
>            Reporter: Ali Naddaf
>            Assignee: Karl Pauls
>            Priority: Minor
>             Fix For: felix-1.4.0
>
>
> I am seeing an exception in the URLHandlersBundleStreamHandler.openConnection(URL) method. Here is the part I am referring to:
> if (framework != null)
>        {
>            // TODO: optimize this to not use reflection if not needed
>            try
>            {
>                Class targetClass = framework.getClass().getClassLoader().loadClass(
>                    URLHandlersBundleURLConnection.class.getName());
>                              return (URLConnection) m_action.invoke(m_action.getConstructor(targetClass,
>                    new Class[]{URL.class, framework.getClass()}),
>                    new Object[]{url, framework});
>            }
>            catch (Exception ex)
>            {
>                throw new IOException(ex.getMessage());
>            }
>        }
>        throw new IOException("No framework context found");
> The problem happens when reflection fails to find the appropriate constructor and throws a NoSuchMethodException; here the targetClass resolves to "org.apache.felix.framework.URLHandlersBundleURLConnection" and
> the exception is:
> java.lang.NoSuchMethodException: org.apache.felix.framework.URLHandlersBundleURLConnection.<init>(java.net.URL, org.simplecenter.application.SimpleCenterApplication)
> Note that SimpleCenterApplicaion extends Felix and  URLHandlersBundleURLConnection has the constructor URLHandlersBundleURLConnection(URL, Felix). 

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


[jira] Updated: (FELIX-800) URLHandlersBundleStreamHandler.openConnection(URL) fails when extending Felix

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

Karl Pauls updated FELIX-800:
-----------------------------

          Component/s:     (was: Felix Commons)
                       Framework
             Priority: Minor  (was: Major)
    Affects Version/s: felix-1.0.4
                       felix-1.2.0
                       
felix-1.2.1

                       felix-1.2.2
        Fix Version/s: felix-1.4.0
             Assignee: Karl Pauls

The issue is that we didn't assume somebody could extend the org.apache.felix.framework.Felix class. The fix is to use framework.getClass().getClassloader().loadClass(Felix.class.getName()) instead of framework.getClass(). This needs to be changed in more then one place and should make it into 1.4.0.

> URLHandlersBundleStreamHandler.openConnection(URL) fails when extending Felix
> -----------------------------------------------------------------------------
>
>                 Key: FELIX-800
>                 URL: https://issues.apache.org/jira/browse/FELIX-800
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-1.0.4, felix-1.2.0, felix-1.2.1
, felix-1.2.2
>            Reporter: Ali Naddaf
>            Assignee: Karl Pauls
>            Priority: Minor
>             Fix For: felix-1.4.0
>
>
> I am seeing an exception in the URLHandlersBundleStreamHandler.openConnection(URL) method. Here is the part I am referring to:
> if (framework != null)
>        {
>            // TODO: optimize this to not use reflection if not needed
>            try
>            {
>                Class targetClass = framework.getClass().getClassLoader().loadClass(
>                    URLHandlersBundleURLConnection.class.getName());
>                              return (URLConnection) m_action.invoke(m_action.getConstructor(targetClass,
>                    new Class[]{URL.class, framework.getClass()}),
>                    new Object[]{url, framework});
>            }
>            catch (Exception ex)
>            {
>                throw new IOException(ex.getMessage());
>            }
>        }
>        throw new IOException("No framework context found");
> The problem happens when reflection fails to find the appropriate constructor and throws a NoSuchMethodException; here the targetClass resolves to "org.apache.felix.framework.URLHandlersBundleURLConnection" and
> the exception is:
> java.lang.NoSuchMethodException: org.apache.felix.framework.URLHandlersBundleURLConnection.<init>(java.net.URL, org.simplecenter.application.SimpleCenterApplication)
> Note that SimpleCenterApplicaion extends Felix and  URLHandlersBundleURLConnection has the constructor URLHandlersBundleURLConnection(URL, Felix). 

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