FELIX-2167 Call Bundle.update() to update the bundle using bundle manifest provided update location instead of implementing update through Bundle location ourselves.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@918922 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java
index 4a9ba3e..ea63bc7 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateHelper.java
@@ -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;
- }
+ bundle.update();
+ getLog().log( LogService.LOG_INFO, "Bundle updated from bundle provided (update) location" );
+ return true;
}
- catch ( IOException ioe )
+ catch ( Throwable 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 );
- }
- finally
- {
- 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