felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1587490 - /felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/AbstractDeploymentPackage.java
Date Tue, 15 Apr 2014 09:37:44 GMT
Author: jawi
Date: Tue Apr 15 09:37:43 2014
New Revision: 1587490

URL: http://svn.apache.org/r1587490
Log:
FELIX-4484 only mark DPs as stale after successful uninstall:

- if an uninstall fails, we should be able to call uninstallForced to
  retry it. When the DP is already marked as stale, this wouldn't work.


Modified:
    felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/AbstractDeploymentPackage.java

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/AbstractDeploymentPackage.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/AbstractDeploymentPackage.java?rev=1587490&r1=1587489&r2=1587490&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/AbstractDeploymentPackage.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/AbstractDeploymentPackage.java
Tue Apr 15 09:37:43 2014
@@ -36,6 +36,7 @@ import org.osgi.service.deploymentadmin.
 import org.osgi.service.deploymentadmin.DeploymentException;
 import org.osgi.service.deploymentadmin.DeploymentPackage;
 import org.osgi.service.deploymentadmin.spi.ResourceProcessor;
+import org.osgi.service.log.LogService;
 
 /**
  * Base class for various types of deployment packages. Indifferent in regard to
@@ -279,9 +280,7 @@ public abstract class AbstractDeployment
             return null;
         } else {
             try {
-                // TODO spec states this must be a local resource, but we don't
-// make
-                // sure of that yet
+                // TODO spec states this must be a local resource, but we don't make sure
of that yet
                 return new URL(icon);
             }
             catch (MalformedURLException e) {
@@ -315,7 +314,7 @@ public abstract class AbstractDeployment
                     }
                 }
                 catch (InvalidSyntaxException e) {
-                    // TODO: log this
+                    m_deploymentAdmin.getLog().log(LogService.LOG_WARNING, "Invalid resource
processor name: " + processor, e);
                     return null;
                 }
             }
@@ -361,24 +360,24 @@ public abstract class AbstractDeployment
 
     public void uninstall() throws DeploymentException {
         if (isStale()) {
-            throw new IllegalStateException("Deployment package is stale, cannot uninstall.");
-        }
-        try {
-            m_deploymentAdmin.uninstallDeploymentPackage(this, false /* force */);
-        }
-        finally {
-            setStale(true);
+            throw new IllegalStateException("Deployment package is stale, cannot uninstall!");
         }
+
+        m_deploymentAdmin.uninstallDeploymentPackage(this, false /* force */);
+        // FELIX-4484: only mark a DP as stale when it is *successfully* uninstalled...
+        setStale(true);
     }
 
     public boolean uninstallForced() throws DeploymentException {
         if (isStale()) {
-            throw new IllegalStateException("Deployment package is stale, cannot uninstall.");
+            throw new IllegalStateException("Deployment package is stale, cannot force uninstallation!");
         }
+
         try {
             m_deploymentAdmin.uninstallDeploymentPackage(this, true /* force */);
         }
         finally {
+            // FELIX-4484: this is a best-effort method, if it fails, we cannot do anything
about it anymore...
             setStale(true);
         }
         return true;



Mime
View raw message