Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Oberlies2012-10-01 08:44:02 -0400
committerTobias Oberlies2012-10-01 08:52:39 -0400
commit5ff2bd944bf00db8f06f8a33ae7cc16eecee930c (patch)
treec7c9bb0c3edeef445dd4bfec776bd2dd75d8693e /bundles/org.eclipse.equinox.p2.publisher
parentaa6e786cd25e59f8f36e22099f3239a553b0bc2f (diff)
downloadrt.equinox.p2-5ff2bd944bf00db8f06f8a33ae7cc16eecee930c.tar.gz
rt.equinox.p2-5ff2bd944bf00db8f06f8a33ae7cc16eecee930c.tar.xz
rt.equinox.p2-5ff2bd944bf00db8f06f8a33ae7cc16eecee930c.zip
388566 Fix corner case when publishing a single osgi.ee capability
- Fix case where a profile only specifies a single version for an osgi.ee capability and hence uses the version:Version attribute instead of the more common version:List<Version> attribute. - Also: Fail if both version:Version and version:List<Version> is specified in a single system capability entry. Bug: 388566 JREAction: Publish osgi.ee capabilities in 'a.jre' IUs
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.publisher')
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties5
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java24
3 files changed, 26 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java
index 9a938b8cc..0b8f76634 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/Messages.java
@@ -43,6 +43,7 @@ public class Messages extends NLS {
public static String message_eeInvalidVersionAttribute;
public static String message_eeMissingNameAttribute;
public static String message_eeMissingVersionAttribute;
+ public static String message_eeDuplicateVersionAttribute;
public static String exception_artifactRepoNoAppendDestroysInput;
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties
index dd655204b..6d1f30db8 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/messages.properties
@@ -23,10 +23,11 @@ exception_invalidSiteReferenceInFeature=Invalid site reference {0} in feature {1
exception_repoMustBeURL=Repository location ({0}) must be a URL.
exception_sourcePath=Source location ({0}) must be a valid file-system path.
exception_nonExistingJreLocationFile=Provided location to JRE \"{0}\" does not exist on the file system.
+message_eeDuplicateVersionAttribute=Cannot specify both ''version:Version'' and ''version:List<Version>'' in one entry: {0}
message_eeIgnoringNamespace=Ignoring unknown capability namespace ''{0}''
message_eeInvalidVersionAttribute=Syntax error in version ''{0}''
-message_eeMissingNameAttribute=Attribute ''osgi.ee'' is missing for entry {0}
-message_eeMissingVersionAttribute=Attribute ''version:List<Version>'' is missing for execution environment ''{0}''
+message_eeMissingNameAttribute=Attribute ''osgi.ee'' is missing in entry {0}
+message_eeMissingVersionAttribute=Either ''version:Version'' or ''version:List<Version>'' must be specified in entry {0}
message_generatingMetadata = Generating metadata for {0}.
message_generationCompleted = Generation completed with success [{0} seconds].
message_noSimpleconfigurator = Could not find simpleconfigurator bundle.
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java
index ae10c179e..9186fb0bc 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java
@@ -208,9 +208,9 @@ public class JREAction extends AbstractPublisherAction {
return;
}
- String[] eeVersions = ManifestElement.getArrayFromList(eeCapability.getAttribute("version:List<Version>")); //$NON-NLS-1$
+ String[] eeVersions = parseEECapabilityVersion(eeCapability, parsingStatus);
if (eeVersions == null) {
- parsingStatus.add(newErrorStatus(NLS.bind(Messages.message_eeMissingVersionAttribute, eeName), null));
+ // status was already updated by parse method
return;
}
@@ -228,6 +228,26 @@ public class JREAction extends AbstractPublisherAction {
}
}
+ private static String[] parseEECapabilityVersion(ManifestElement eeCapability, MultiStatus parsingStatus) {
+ String singleVersion = eeCapability.getAttribute("version:Version"); //$NON-NLS-1$
+ String[] multipleVersions = ManifestElement.getArrayFromList(eeCapability.getAttribute("version:List<Version>")); //$NON-NLS-1$
+
+ if (singleVersion == null && multipleVersions == null) {
+ parsingStatus.add(newErrorStatus(NLS.bind(Messages.message_eeMissingVersionAttribute, eeCapability), null));
+ return null;
+
+ } else if (singleVersion == null) {
+ return multipleVersions;
+
+ } else if (multipleVersions == null) {
+ return new String[] {singleVersion};
+
+ } else {
+ parsingStatus.add(newErrorStatus(NLS.bind(Messages.message_eeDuplicateVersionAttribute, eeCapability), null));
+ return null;
+ }
+ }
+
private void generateJREIUData(InstallableUnitDescription iu) {
if (profileProperties == null || profileProperties.size() == 0)
return; //got nothing

Back to the top