[Yanel-commits] rev 47681 - public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils

michi at wyona.com michi at wyona.com
Sun Feb 21 23:52:05 CET 2010


Author: michi
Date: 2010-02-21 23:52:04 +0100 (Sun, 21 Feb 2010)
New Revision: 47681

Modified:
   public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/UpdateInfo.java
Log:
get updater fixed

Modified: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/UpdateInfo.java
===================================================================
--- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/UpdateInfo.java	2010-02-21 22:51:37 UTC (rev 47680)
+++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/update-webapp/src/java/org/wyona/yanel/impl/resources/updatefinder/utils/UpdateInfo.java	2010-02-21 22:52:04 UTC (rev 47681)
@@ -216,17 +216,21 @@
         VersionComparator versionComparator = new VersionComparator();
         List<Map<String, String>> bestUpdater = getUpdateVersionsOf("type", "updater");
         if (bestUpdater == null) return null;
-        for (int i = 0; i < bestUpdater.size(); i++) {
+        for (int i = bestUpdater.size() - 1; i >= 0; i--) { // INFO: Start at the end, because otherwise remove(int) will lead to strange results
             Map<String, String> versionDetail = bestUpdater.get(i);
             log.warn("DEBUG: Updater MinRevision: " + versionDetail.get(TARGET_APPLICATION_MIN_REVISION));
             log.warn("DEBUG: Updater MaxRevision: " +versionDetail.get(TARGET_APPLICATION_MAX_REVISION));
-            if (versionComparator.compare( versionDetail.get(TARGET_APPLICATION_MIN_REVISION), yanelRevision) > 0 ) {
+            if (versionComparator.compare(versionDetail.get(TARGET_APPLICATION_MIN_REVISION), yanelRevision) > 0 ) {
                 bestUpdater.remove(i);
+                continue;
             }
             if (versionComparator.compare(versionDetail.get(TARGET_APPLICATION_MAX_REVISION), yanelRevision) < 0 ) {
                 bestUpdater.remove(i);
+                continue;
             }
+            log.warn("DEBUG: Workable updater: " + versionDetail.get("revision"));
         }
+
         Collections.sort(bestUpdater, new UpdateInfoVersionComparator());
         if (bestUpdater.size() < 1)  return null;
         return bestUpdater;
@@ -255,15 +259,15 @@
             log.warn("DEBUG: Check update revision: " + updateRevision);
             if (versionComparator.compare(updatesVersionDetail.get(TARGET_APPLICATION_MIN_REVISION), yanelRevision) > 0 ) {
                 allUpdates.remove(i);
+                continue;
             }
             if (versionComparator.compare(updatesVersionDetail.get(TARGET_APPLICATION_MAX_REVISION), yanelRevision) < 0 ) {
                 allUpdates.remove(i);
+                continue;
             }
             log.warn("DEBUG: Workable update revision: " + updateRevision);
         }
 
-
-
         // Get all updaters which work for yanelRevision
         List<Map<String, String>> updaters = getUpdatersForYanelRevision(yanelRevision);
         if (updaters == null) {



More information about the Yanel-commits mailing list