From: Bruno Sinou Date: Tue, 4 Feb 2014 21:39:07 +0000 (+0000) Subject: Fix a bug in determination of the highest version of all bundles contained in a group. X-Git-Tag: argeo-slc-2.1.7~256 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=74b4eb4af83276d7850177cc43ff001ac633262c;p=gpl%2Fargeo-slc.git Fix a bug in determination of the highest version of all bundles contained in a group. git-svn-id: https://svn.argeo.org/slc/trunk@6807 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/NormalizeGroup.java b/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/NormalizeGroup.java index 58f832c0a..0d1eded08 100644 --- a/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/NormalizeGroup.java +++ b/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/NormalizeGroup.java @@ -127,6 +127,17 @@ public class NormalizeGroup implements Runnable, SlcNames { if (allArtifactsHighestVersion == null) allArtifactsHighestVersion = aVersion; + // BS will fail if artifacts arrive in this order + // Name1 - V1, name2 - V3, V1 will remain the + // allArtifactsHighestVersion + // Fixed below + else { + Version currVersion = extractOsgiVersion(aVersion); + Version highestVersion = extractOsgiVersion(allArtifactsHighestVersion); + if (currVersion.compareTo(highestVersion) > 0) + allArtifactsHighestVersion = aVersion; + } + } else { Version currVersion = extractOsgiVersion(aVersion); Version currentHighestVersion = extractOsgiVersion(highestAVersion); @@ -158,7 +169,7 @@ public class NormalizeGroup implements Runnable, SlcNames { } } - // if version not set or empty, use the highets version + // if version not set or empty, use the highest version // useful when indexing a product maven repository where // all artifacts have the same version for a given release // => the version can then be left empty @@ -187,10 +198,11 @@ public class NormalizeGroup implements Runnable, SlcNames { // indexes Set indexes = new TreeSet( new ArtifactIdComparator()); - Artifact indexArtifact = writeIndex(session, RepoConstants.BINARIES_ARTIFACT_ID, - binaries); + Artifact indexArtifact = writeIndex(session, + RepoConstants.BINARIES_ARTIFACT_ID, binaries); indexes.add(indexArtifact); - indexArtifact = writeIndex(session, RepoConstants.SOURCES_ARTIFACT_ID, sources); + indexArtifact = writeIndex(session, RepoConstants.SOURCES_ARTIFACT_ID, + sources); indexes.add(indexArtifact); // sdk writeIndex(session, RepoConstants.SDK_ARTIFACT_ID, indexes); @@ -403,7 +415,8 @@ public class NormalizeGroup implements Runnable, SlcNames { p.append("\t").append(groupId).append("\n"); p.append("\t") .append(ownSymbolicName.endsWith(".source") ? RepoConstants.SOURCES_ARTIFACT_ID - : RepoConstants.BINARIES_ARTIFACT_ID).append("\n"); + : RepoConstants.BINARIES_ARTIFACT_ID) + .append("\n"); p.append("\t").append(version).append("\n"); p.append("\tpom\n"); p.append("\timport\n");