[ 
https://issues.apache.org/jira/browse/FELIX-2119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12841123#action_12841123
 ] 

Valentin Valchev commented on FELIX-2119:
-----------------------------------------

Ok, now it works even if OBR is not installed. I'm just curious why the 
updateFromBundleLocation() method is so complex?

If we update a bundle from it's own location, then why bothering opening 
getting it's location, creating URL, getting the stream, update from the new 
stream, and then make sure stream is closed ..

Isn't it better to leave the framework do it's job and just use 
bundle.update(), instead of bundle.update(InputStream). Plus, the framework 
might have some optimizations on this update, and may perform it faster, than 
us (example it might internally cache the URL object for the location, might 
also check last updated time of the URLConnection, and if no-later than 
current, might decide to simply ignore the update operation).

So IMHO, the method show be:
private boolean updateFromBundleLocation() throws BundleException
    {
        getLog().log( LogService.LOG_DEBUG, "Trying to update from bundle 
location " + location );

        try
        {
                bundle.update();
                getLog().log( LogService.LOG_INFO, "Bundle updated from bundle 
location " + location );
                return true;
            }
        }
        catch ( Throwable ioe )
        {
            // BundleException, IllegalStateException or SecurityException? 
lets use OBR then
            getLog().log( LogService.LOG_DEBUG, "Update failure from bundle 
location " + location, ioe );
        }
        // not installed from the bundle location
        return false;
    }

> Bundle update fails, if OBR is not installed
> --------------------------------------------
>
>                 Key: FELIX-2119
>                 URL: https://issues.apache.org/jira/browse/FELIX-2119
>             Project: Felix
>          Issue Type: Bug
>          Components: Web Console
>            Reporter: Valentin Valchev
>             Fix For: webconsole-3.0.0
>
>
> The reason for this is that UpdateHelper depends on OBR service API. While 
> OBR is not a core service, its absence shouldn't disallow execution of normal 
> bundle life-cycle commands.
> Stack trace:
> Exception: java.lang.NoClassDefFoundError: [Lorg/osgi/service/obr/Resource;
>         at java.lang.Class.getDeclaredMethods0(Native Method)
>         at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
>         at java.lang.Class.getDeclaredMethod(Unknown Source)
>         at java.lang.Thread$1.run(Unknown Source)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.lang.Thread.auditSubclass(Unknown Source)
>         at java.lang.Thread.isCCLOverridden(Unknown Source)
>         at java.lang.Thread.init(Unknown Source)
>         at java.lang.Thread.<init>(Unknown Source)
>         at 
> org.apache.felix.webconsole.internal.core.BaseUpdateInstallHelper.<init>(BaseUpdateInstallHelper.java:45)
>         at 
> org.apache.felix.webconsole.internal.core.UpdateHelper.<init>(UpdateHelper.java:52)
>         at 
> org.apache.felix.webconsole.internal.core.UpdateHelper.<init>(UpdateHelper.java:46)
>         at 
> org.apache.felix.webconsole.internal.core.BundlesServlet$4.<init>(BundlesServlet.java:1283)
>         at 
> org.apache.felix.webconsole.internal.core.BundlesServlet.update(BundlesServlet.java:1282)
>         at 
> org.apache.felix.webconsole.internal.core.BundlesServlet.doPost(BundlesServlet.java:312)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:815)
>         at 
> org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:372)

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

Reply via email to