sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1777616 - in /sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks: BundleInfo.java BundleUpdateTask.java BundleUtil.java
Date Fri, 06 Jan 2017 14:32:47 GMT
Author: cziegeler
Date: Fri Jan  6 14:32:47 2017
New Revision: 1777616

URL: http://svn.apache.org/viewvc?rev=1777616&view=rev
Log:
SLING-6444 : Improve bundle header evaluation

Modified:
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInfo.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUtil.java

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInfo.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInfo.java?rev=1777616&r1=1777615&r2=1777616&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInfo.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInfo.java
Fri Jan  6 14:32:47 2017
@@ -48,7 +48,7 @@ public class BundleInfo {
 
     private BundleInfo(Bundle b) {
         this.symbolicName = b.getSymbolicName();
-        this.version = new Version((String)b.getHeaders().get(Constants.BUNDLE_VERSION));
+        this.version = b.getVersion();
         this.state = b.getState();
         this.id = b.getBundleId();
     }
@@ -82,17 +82,17 @@ public class BundleInfo {
             }
             if ( matchingBundles.size() > 0 ) {
                 final Version searchVersion = (version == null ? null : new Version(version));
-                if ( searchVersion == null || searchVersion.compareTo(getBundleVersion(matchingBundles.get(0)))
== 0 ) {
+                if ( searchVersion == null || searchVersion.compareTo(matchingBundles.get(0).getVersion())
== 0 ) {
                     match = matchingBundles.get(0);
                 }
                 for(int i=1; i<matchingBundles.size(); i++) {
                     final Bundle current = matchingBundles.get(i);
                     if ( searchVersion == null ) {
-                        if ( getBundleVersion(match).compareTo(getBundleVersion(current))
< 0 ) {
+                        if ( match.getVersion().compareTo(current.getVersion()) < 0 )
{
                             match = current;
                         }
                     } else {
-                        if ( searchVersion.compareTo(getBundleVersion(current)) == 0 ) {
+                        if ( searchVersion.compareTo(current.getVersion()) == 0 ) {
                             match = current;
                             break;
                         }
@@ -103,10 +103,6 @@ public class BundleInfo {
         return match;
     }
 
-    private static Version getBundleVersion(final Bundle b) {
-        return new Version((String)b.getHeaders().get(Constants.BUNDLE_VERSION));
-    }
-
     /**
      * Check if the version is a snapshot version
      */

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java?rev=1777616&r1=1777615&r2=1777616&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java
Fri Jan  6 14:32:47 2017
@@ -73,7 +73,7 @@ public class BundleUpdateTask extends Ab
 
         // Do not update if same version, unless snapshot
         boolean snapshot = false;
-    	final Version currentVersion = new Version(b.getHeaders().get(Constants.BUNDLE_VERSION));
+    	final Version currentVersion = b.getVersion();
     	snapshot = BundleInfo.isSnapshot(newVersion);
     	if (currentVersion.equals(newVersion) && !snapshot) {
     	    // TODO : Isn't this already checked in the task creator?

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUtil.java?rev=1777616&r1=1777615&r2=1777616&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUtil.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUtil.java
Fri Jan  6 14:32:47 2017
@@ -64,13 +64,13 @@ public abstract class BundleUtil {
      * Gets the bundle's Fragment-Host header.
      */
     public static String getFragmentHostHeader(final Bundle b) {
-        return (String) b.getHeaders().get( Constants.FRAGMENT_HOST );
+        return (String) b.getHeaders("").get( Constants.FRAGMENT_HOST );
     }
 
     /**
      * Check if the bundle has the lazy activation policy
      */
     public static boolean isLazyActivatian(final Bundle b) {
-        return Constants.ACTIVATION_LAZY.equals(b.getHeaders().get(Constants.BUNDLE_ACTIVATIONPOLICY));
+        return Constants.ACTIVATION_LAZY.equals(b.getHeaders("").get(Constants.BUNDLE_ACTIVATIONPOLICY));
     }
 }



Mime
View raw message