Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 164635 Details for
Bug 306439
Verify that all metadata fields are properly persisted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
306439.txt (text/plain), 18.41 KB, created by
DJ Houghton
on 2010-04-12 17:36:42 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
DJ Houghton
Created:
2010-04-12 17:36:42 EDT
Size:
18.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.metadata >Index: src/org/eclipse/equinox/internal/p2/metadata/RequiredCapability.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/RequiredCapability.java,v >retrieving revision 1.16 >diff -u -r1.16 RequiredCapability.java >--- src/org/eclipse/equinox/internal/p2/metadata/RequiredCapability.java 10 Apr 2010 00:45:05 -0000 1.16 >+++ src/org/eclipse/equinox/internal/p2/metadata/RequiredCapability.java 12 Apr 2010 21:36:17 -0000 >@@ -87,19 +87,20 @@ > this(namespace, name, range, filter, optional, multiple, true); > } > >- public RequiredCapability(IMatchExpression<IInstallableUnit> requirement, IMatchExpression<IInstallableUnit> filter, int min, int max, boolean greedy) { >+ public RequiredCapability(IMatchExpression<IInstallableUnit> requirement, IMatchExpression<IInstallableUnit> filter, int min, int max, boolean greedy, String description) { > this.matchExpression = requirement; > this.filter = filter; > this.min = min; > this.max = max; > this.greedy = greedy; >+ this.description = description; > } > > public RequiredCapability(String namespace, String name, VersionRange range, String filter, boolean optional, boolean multiple, boolean greedy) { >- this(namespace, name, range, filter == null ? (IMatchExpression<IInstallableUnit>) null : InstallableUnit.parseFilter(filter), optional ? 0 : 1, multiple ? Integer.MAX_VALUE : 1, greedy); >+ this(namespace, name, range, filter == null ? (IMatchExpression<IInstallableUnit>) null : InstallableUnit.parseFilter(filter), optional ? 0 : 1, multiple ? Integer.MAX_VALUE : 1, greedy, null); > } > >- public RequiredCapability(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, int min, int max, boolean greedy) { >+ public RequiredCapability(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, int min, int max, boolean greedy, String description) { > Assert.isNotNull(namespace); > Assert.isNotNull(name); > IExpressionFactory factory = ExpressionUtil.getFactory(); >@@ -125,6 +126,7 @@ > this.max = max; > this.greedy = greedy; > this.filter = filter; >+ this.description = description; > } > > public boolean equals(Object obj) { >Index: src/org/eclipse/equinox/p2/metadata/MetadataFactory.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/MetadataFactory.java,v >retrieving revision 1.20 >diff -u -r1.20 MetadataFactory.java >--- src/org/eclipse/equinox/p2/metadata/MetadataFactory.java 6 Apr 2010 01:04:20 -0000 1.20 >+++ src/org/eclipse/equinox/p2/metadata/MetadataFactory.java 12 Apr 2010 21:36:17 -0000 >@@ -332,22 +332,29 @@ > * @param multiple <code>true</code> if this capability can be satisfied by multiple provided capabilities, or it requires exactly one match > */ > public static IRequirement createRequirement(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, boolean optional, boolean multiple) { >- return new RequiredCapability(namespace, name, range, filter, optional ? 0 : 1, multiple ? Integer.MAX_VALUE : 1, true); >+ return new RequiredCapability(namespace, name, range, filter, optional ? 0 : 1, multiple ? Integer.MAX_VALUE : 1, true, null); > } > > public static IRequirement createRequirement(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, int minCard, int maxCard, boolean greedy) { >- return new RequiredCapability(namespace, name, range, filter, minCard, maxCard, greedy); >+ return new RequiredCapability(namespace, name, range, filter, minCard, maxCard, greedy, null); > } > > public static IRequirement createRequirement(IMatchExpression<IInstallableUnit> requirement, IMatchExpression<IInstallableUnit> filter, int minCard, int maxCard, boolean greedy) { >- return new RequiredCapability(requirement, filter, minCard, maxCard, greedy); >- >+ return new RequiredCapability(requirement, filter, minCard, maxCard, greedy, null); > } > > public static IRequirement createRequirement(String namespace, String name, VersionRange range, String filter, boolean optional, boolean multiple, boolean greedy) { > return new RequiredCapability(namespace, name, range, filter, optional, multiple, greedy); > } > >+ public static IRequirement createRequirement(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, int minCard, int maxCard, boolean greedy, String description) { >+ return new RequiredCapability(namespace, name, range, filter, minCard, maxCard, greedy, description); >+ } >+ >+ public static IRequirement createRequirement(IMatchExpression<IInstallableUnit> requirement, IMatchExpression<IInstallableUnit> filter, int minCard, int maxCard, boolean greedy, String description) { >+ return new RequiredCapability(requirement, filter, minCard, maxCard, greedy, description); >+ } >+ > /** > * Returns a new requirement change. > * @param applyOn The source of the requirement change - the kind of requirement to apply the change to >@@ -496,13 +503,17 @@ > } > > public static IUpdateDescriptor createUpdateDescriptor(Collection<IMatchExpression<IInstallableUnit>> descriptors, int severity, String description, URI location) { >- return new UpdateDescriptor(descriptors, severity, description, null); >+ return new UpdateDescriptor(descriptors, severity, description, location); > } > > public static IUpdateDescriptor createUpdateDescriptor(String id, VersionRange range, int severity, String description) { >+ return createUpdateDescriptor(id, range, severity, description, null); >+ } >+ >+ public static IUpdateDescriptor createUpdateDescriptor(String id, VersionRange range, int severity, String description, URI location) { > Collection<IMatchExpression<IInstallableUnit>> descriptors = new ArrayList<IMatchExpression<IInstallableUnit>>(1); > descriptors.add(createMatchExpressionFromRange(IInstallableUnit.NAMESPACE_IU_ID, id, range)); >- return new UpdateDescriptor(descriptors, severity, description, null); >+ return createUpdateDescriptor(descriptors, severity, description, location); > } > > private static final IExpression allVersionsExpression; >#P org.eclipse.equinox.p2.metadata.repository >Index: src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java,v >retrieving revision 1.44 >diff -u -r1.44 MetadataParser.java >--- src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java 6 Apr 2010 01:04:21 -0000 1.44 >+++ src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java 12 Apr 2010 21:36:19 -0000 >@@ -580,6 +580,7 @@ > private boolean greedy; > > private TextHandler filterHandler = null; >+ private TextHandler descriptionHandler = null; > > public RequirementHandler(AbstractHandler parentHandler, Attributes attributes, List<IRequirement> capabilities) { > super(parentHandler, REQUIREMENT_ELEMENT); >@@ -608,43 +609,47 @@ > public void startElement(String name, Attributes attributes) { > if (name.equals(CAPABILITY_FILTER_ELEMENT)) { > filterHandler = new TextHandler(this, CAPABILITY_FILTER_ELEMENT, attributes); >+ } else if (name.equals(REQUIREMENT_DESCRIPTION_ELEMENT)) { >+ descriptionHandler = new TextHandler(this, REQUIREMENT_DESCRIPTION_ELEMENT, attributes); > } else { > invalidElement(name, attributes); > } > } > > protected void finished() { >- if (isValidXML()) { >- IMatchExpression<IInstallableUnit> filter = null; >- if (filterHandler != null) >- try { >- filter = InstallableUnit.parseFilter(filterHandler.getText()); >- } catch (ExpressionParseException e) { >- if (removeWhiteSpace(filterHandler.getText()).equals("(&(|)(|)(|))")) {//$NON-NLS-1$ >- // We could log this I guess >- } else { >- throw e; >- } >- } >- IRequirement requirement; >- if (match != null) { >- IExpressionFactory factory = ExpressionUtil.getFactory(); >- IExpression expr = ExpressionUtil.parse(match); >- Object[] params; >- if (matchParams == null) >- params = new Object[0]; >- else { >- IExpression[] arrayExpr = ExpressionUtil.getOperands(ExpressionUtil.parse(matchParams)); >- params = new Object[arrayExpr.length]; >- for (int idx = 0; idx < arrayExpr.length; ++idx) >- params[idx] = arrayExpr[idx].evaluate(null); >+ if (!isValidXML()) >+ return; >+ IMatchExpression<IInstallableUnit> filter = null; >+ if (filterHandler != null) { >+ try { >+ filter = InstallableUnit.parseFilter(filterHandler.getText()); >+ } catch (ExpressionParseException e) { >+ if (removeWhiteSpace(filterHandler.getText()).equals("(&(|)(|)(|))")) {//$NON-NLS-1$ >+ // We could log this I guess >+ } else { >+ throw e; > } >- IMatchExpression<IInstallableUnit> matchExpr = factory.matchExpression(expr, params); >- requirement = MetadataFactory.createRequirement(matchExpr, filter, min, max, greedy); >- } else >- requirement = MetadataFactory.createRequirement(namespace, name, range, filter, min, max, greedy); >- capabilities.add(requirement); >+ } > } >+ String description = descriptionHandler == null ? null : descriptionHandler.getText(); >+ IRequirement requirement; >+ if (match != null) { >+ IExpressionFactory factory = ExpressionUtil.getFactory(); >+ IExpression expr = ExpressionUtil.parse(match); >+ Object[] params; >+ if (matchParams == null) >+ params = new Object[0]; >+ else { >+ IExpression[] arrayExpr = ExpressionUtil.getOperands(ExpressionUtil.parse(matchParams)); >+ params = new Object[arrayExpr.length]; >+ for (int idx = 0; idx < arrayExpr.length; ++idx) >+ params[idx] = arrayExpr[idx].evaluate(null); >+ } >+ IMatchExpression<IInstallableUnit> matchExpr = factory.matchExpression(expr, params); >+ requirement = MetadataFactory.createRequirement(matchExpr, filter, min, max, greedy, description); >+ } else >+ requirement = MetadataFactory.createRequirement(namespace, name, range, filter, min, max, greedy, description); >+ capabilities.add(requirement); > } > > private String removeWhiteSpace(String s) { >@@ -808,7 +813,8 @@ > String[] values = parseAttributes(attributes, required, optional); > VersionRange range = checkVersionRange(REQUIREMENT_ELEMENT, VERSION_RANGE_ATTRIBUTE, values[1]); > int severity = new Integer(values[2]).intValue(); >- descriptor = MetadataFactory.createUpdateDescriptor(values[0], range, severity, values[3]); >+ URI location = parseURIAttribute(attributes, false); >+ descriptor = MetadataFactory.createUpdateDescriptor(values[0], range, severity, values[3], location); > } > > public IUpdateDescriptor getUpdateDescriptor() { >Index: src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java,v >retrieving revision 1.30 >diff -u -r1.30 MetadataWriter.java >--- src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java 10 Mar 2010 14:39:00 -0000 1.30 >+++ src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java 12 Apr 2010 21:36:19 -0000 >@@ -246,7 +246,9 @@ > } > attribute(CAPABILITY_GREED_ATTRIBUTE, requirement.isGreedy(), true); > if (requirement.getFilter() != null) >- writeTrimmedCdata(CAPABILITY_FILTER_ELEMENT, requirement.getFilter().getParameters()[0].toString()); >+ writeTrimmedCdata(CAPABILITY_FILTER_ELEMENT, requirement.getFilter().getParameters()[0].toString()); >+ if (requirement.getDescription() != null) >+ writeTrimmedCdata(REQUIREMENT_DESCRIPTION_ELEMENT, requirement.getDescription()); > end(REQUIREMENT_ELEMENT); > } > >Index: src/org/eclipse/equinox/internal/p2/metadata/repository/io/XMLConstants.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/XMLConstants.java,v >retrieving revision 1.22 >diff -u -r1.22 XMLConstants.java >--- src/org/eclipse/equinox/internal/p2/metadata/repository/io/XMLConstants.java 10 Mar 2010 09:51:08 -0000 1.22 >+++ src/org/eclipse/equinox/internal/p2/metadata/repository/io/XMLConstants.java 12 Apr 2010 21:36:19 -0000 >@@ -65,6 +65,7 @@ > > // Constants for sub-elements of a required capability element > public static final String CAPABILITY_FILTER_ELEMENT = "filter"; //$NON-NLS-1$ >+ public static final String REQUIREMENT_DESCRIPTION_ELEMENT = "description"; //$NON-NLS-1$ > > // Constants for attributes of a required capability element > public static final String CAPABILITY_OPTIONAL_ATTRIBUTE = "optional"; //$NON-NLS-1$ >#P org.eclipse.equinox.p2.tests >Index: src/org/eclipse/equinox/p2/tests/planner/Bug306424.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306424.java,v >retrieving revision 1.3 >diff -u -r1.3 Bug306424.java >--- src/org/eclipse/equinox/p2/tests/planner/Bug306424.java 12 Apr 2010 20:57:19 -0000 1.3 >+++ src/org/eclipse/equinox/p2/tests/planner/Bug306424.java 12 Apr 2010 21:36:19 -0000 >@@ -16,7 +16,6 @@ > import java.util.Collection; > import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; >-import org.eclipse.equinox.internal.p2.metadata.RequiredCapability; > import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest; > import org.eclipse.equinox.p2.engine.*; > import org.eclipse.equinox.p2.metadata.*; >@@ -79,7 +78,7 @@ > IProfileChangeRequest changeRequest = new ProfileChangeRequest(profile); > changeRequest.remove(b); > >- IRequirement negateB = new RequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, b.getId(), new VersionRange(b.getVersion(), true, b.getVersion(), true), null, 0, 0, false); >+ IRequirement negateB = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, b.getId(), new VersionRange(b.getVersion(), true, b.getVersion(), true), null, 0, 0, false); > Collection<IRequirement> extraReqs = new ArrayList<IRequirement>(); > extraReqs.add(negateB); > changeRequest.addExtraRequirements(extraReqs); >Index: src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java,v >retrieving revision 1.11 >diff -u -r1.11 NegationTesting.java >--- src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java 6 Apr 2010 01:04:10 -0000 1.11 >+++ src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java 12 Apr 2010 21:36:19 -0000 >@@ -47,7 +47,7 @@ > MetadataFactory.InstallableUnitDescription iud1 = new MetadataFactory.InstallableUnitDescription(); > iud1.setId("TestNegation4"); > iud1.setVersion(Version.create("1.0.0")); >- RequiredCapability req1 = new RequiredCapability(NS, N, new VersionRange("[1.1.0, 1.2.0)"), null, 0, 0, false); >+ RequiredCapability req1 = new RequiredCapability(NS, N, new VersionRange("[1.1.0, 1.2.0)"), null, 0, 0, false, null); > RequiredCapability req2 = new RequiredCapability(NS, N, new VersionRange("[1.0.0, 2.0.0)"), null, false, false); > Collection requirements = new ArrayList(); > requirements.add(req1); >@@ -105,7 +105,7 @@ > MetadataFactory.InstallableUnitDescription iud1 = new MetadataFactory.InstallableUnitDescription(); > iud1.setId("TestNegation4"); > iud1.setVersion(Version.create("1.0.0")); >- RequiredCapability req1 = new RequiredCapability(NS, N, new VersionRange("[1.1.0, 1.2.0)"), null, 0, 0, false); >+ RequiredCapability req1 = new RequiredCapability(NS, N, new VersionRange("[1.1.0, 1.2.0)"), null, 0, 0, false, null); > RequiredCapability req2 = new RequiredCapability(NS, N, new VersionRange("[1.0.0, 1.1.0)"), null, false, false); > Collection requirements = new ArrayList(); > requirements.add(req1); >@@ -146,7 +146,7 @@ > MetadataFactory.InstallableUnitDescription iud1 = new MetadataFactory.InstallableUnitDescription(); > iud1.setId("TestNegation4"); > iud1.setVersion(Version.create("1.0.0")); >- RequiredCapability req1 = new RequiredCapability(NS, N, new VersionRange("[1.1.0, 1.2.0)"), null, 0, 0, false); >+ RequiredCapability req1 = new RequiredCapability(NS, N, new VersionRange("[1.1.0, 1.2.0)"), null, 0, 0, false, null); > RequiredCapability req2 = new RequiredCapability(NS, N, new VersionRange("[1.0.0, 1.1.0)"), null, false, false); > Collection requirements = new ArrayList(); > requirements.add(req1); >@@ -188,7 +188,7 @@ > MetadataFactory.InstallableUnitDescription iud1 = new MetadataFactory.InstallableUnitDescription(); > iud1.setId("TestNegation4"); > iud1.setVersion(Version.create("1.0.0")); >- RequiredCapability req1 = new RequiredCapability(NS, N, new VersionRange("[1.1.0, 1.2.0)"), null, 0, 0, false); >+ RequiredCapability req1 = new RequiredCapability(NS, N, new VersionRange("[1.1.0, 1.2.0)"), null, 0, 0, false, null); > RequiredCapability req2 = new RequiredCapability(NS, N, new VersionRange("[1.0.0, 2.0.0)"), null, false, false); > Collection requirements = new ArrayList(); > requirements.add(req1); >@@ -249,7 +249,7 @@ > MetadataFactory.InstallableUnitDescription iud1 = new MetadataFactory.InstallableUnitDescription(); > iud1.setId("TestNegation4"); > iud1.setVersion(Version.create("1.0.0")); >- RequiredCapability req1 = new RequiredCapability(NS, N, new VersionRange("[1.1.0, 1.2.0)"), null, 0, 0, false); >+ RequiredCapability req1 = new RequiredCapability(NS, N, new VersionRange("[1.1.0, 1.2.0)"), null, 0, 0, false, null); > RequiredCapability req2 = new RequiredCapability(NS, N, new VersionRange("[1.0.0, 2.0.0)"), null, false, false); > Collection requirements = new ArrayList(); > requirements.add(req1);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 306439
:
162484
|
162485
|
162486
|
164122
|
164376
| 164635