You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2010/03/04 11:16:41 UTC

svn commit: r918922 - /felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java

Author: fmeschbe
Date: Thu Mar  4 10:16:41 2010
New Revision: 918922

URL: http://svn.apache.org/viewvc?rev=918922&view=rev
Log:
FELIX-2167 Call Bundle.update() to update the bundle using bundle manifest provided update location instead of implementing update through Bundle location ourselves.

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java?rev=918922&r1=918921&r2=918922&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java Thu Mar  4 10:16:41 2010
@@ -22,9 +22,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
-
-import org.apache.commons.io.IOUtils;
 import org.apache.felix.webconsole.internal.obr.DeployerThread;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
@@ -97,32 +94,20 @@
     }
 
 
-    private boolean updateFromBundleLocation() throws BundleException
+    private boolean updateFromBundleLocation()
     {
-        final String location = bundle.getLocation();
-        getLog().log( LogService.LOG_DEBUG, "Trying to update from bundle location " + location );
+        getLog().log( LogService.LOG_DEBUG, "Trying to update with Bundle.update()" );
 
-        InputStream input = null;
         try
         {
-            final URL locationURL = new URL( location );
-            input = locationURL.openStream();
-            if ( input != null )
-            {
-                doRun( input );
-                getLog().log( LogService.LOG_INFO, "Bundle updated from bundle location " + location );
-                return true;
-            }
-        }
-        catch ( IOException ioe )
-        {
-            // MalformedURLException: cannot create an URL/input for the location, use OBR
-            // IOException: cannot open stream on URL ? lets use OBR then
-            getLog().log( LogService.LOG_DEBUG, "Update failure from bundle location " + location, ioe );
+            bundle.update();
+            getLog().log( LogService.LOG_INFO, "Bundle updated from bundle provided (update) location" );
+            return true;
         }
-        finally
+        catch ( Throwable ioe )
         {
-            IOUtils.closeQuietly( input );
+            // BundleException, IllegalStateException or SecurityException? lets use OBR then
+            getLog().log( LogService.LOG_DEBUG, "Update failure using Bundle.update()", ioe );
         }
 
         // not installed from the bundle location