incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1445581 - in /sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl: EntityResourceList.java PersistentResourceList.java tasks/BundleStartTask.java tasks/BundleTaskCreator.java
Date Wed, 13 Feb 2013 13:19:43 GMT
Author: cziegeler
Date: Wed Feb 13 13:19:42 2013
New Revision: 1445581

URL: http://svn.apache.org/r1445581
Log:
SLING-2731 :  Bundle is sometimes not downgraded 

Modified:
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java?rev=1445581&r1=1445580&r2=1445581&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
Wed Feb 13 13:19:42 2013
@@ -355,8 +355,8 @@ public class EntityResourceList implemen
             }
             first = false;
         }
-        
-        if(!toDelete.isEmpty()) {
+
+        if (!toDelete.isEmpty()) {
             // Avoid resources.remove(r) as the resource might have
             // changed since it was added, which causes it to compare()
             // differently and trip the TreeSet.remove() search.
@@ -372,7 +372,7 @@ public class EntityResourceList implemen
                 startNewCycle = true;
             }
         }
-        
+
         return startNewCycle;
     }
 }

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java?rev=1445581&r1=1445580&r2=1445581&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java
Wed Feb 13 13:19:42 2013
@@ -99,6 +99,8 @@ public class PersistentResourceList {
                 logger.debug("Restored unknown resource list: {}", unknownList);
             } catch (final Exception e) {
                 logger.warn("Unable to restore data, starting with empty list (" + e.getMessage()
+ ")", e);
+                restoredData = null;
+                unknownList = null;
             } finally {
                 if (ois != null) {
                     try {
@@ -116,8 +118,9 @@ public class PersistentResourceList {
 
         // update resource ids
         for(final Map.Entry<String, EntityResourceList> entry : this.data.entrySet())
{
-            entry.getValue().setResourceId(entry.getKey());
-            entry.getValue().setListener(listener);
+            final EntityResourceList erl = entry.getValue();
+            erl.setResourceId(entry.getKey());
+            erl.setListener(listener);
         }
 
         // check for special resources

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java?rev=1445581&r1=1445580&r2=1445581&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java
Wed Feb 13 13:19:42 2013
@@ -76,7 +76,7 @@ public class BundleStartTask extends Abs
             return;
         }
 
-        // and another sanity chheck
+        // and another sanity check
         final Bundle b = this.getBundleContext().getBundle(bundleId);
         if (b == null) {
             this.getLogger().debug("Cannot start bundle, id not found: {}", bundleId);

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java?rev=1445581&r1=1445580&r2=1445581&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java
Wed Feb 13 13:19:42 2013
@@ -164,7 +164,8 @@ public class BundleTaskCreator
 	            if ( second != null &&
 	                ( second.getState() == ResourceState.IGNORED || second.getState() == ResourceState.INSTALLED
|| second.getState() == ResourceState.INSTALL ) ) {
                     second.setAttribute(FORCE_INSTALL_VERSION, info.version.toString());
-                    logger.debug("Detected downgrad of bundle {}", symbolicName);
+                    BundleUtil.clearBundleStart(second);
+                    logger.debug("Detected downgrade of bundle {}", symbolicName);
                     result = new ChangeStateTask(resourceList, ResourceState.UNINSTALLED);
 	            } else {
 	                // prevent uninstalling the installer itself!



Mime
View raw message