Bug 14282 - API: PluginVersionIdentifier must provide gentler validity check
Summary: API: PluginVersionIdentifier must provide gentler validity check
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: 2.0 F2   Edit
Assignee: DJ Houghton CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks: 15679
  Show dependency tree
 
Reported: 2002-04-20 13:12 EDT by Dejan Glozic CLA
Modified: 2002-05-31 17:09 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dejan Glozic CLA 2002-04-20 13:12:22 EDT
At the moment, the only way to ensure a version string conforms to the version 
requirements it to create a PluginVersionIdentifier and catch a runtime 
exception. This is specifically discouraged by the spec and the exception 
itself (AssertationFailedException) is not API.

We need a public static method on PluginVersionIdentifier that informs about 
problems without throwing an exception. For example:

public static IStatus verifyVersion(String version);

If version conforms, it returns null. Otherwise, a status object is created and 
returned with an exact reason why the string does not conform. Users can use 
this status object to throw their own exceptions or show error dialogs.
Comment 1 DJ Houghton CLA 2002-04-22 11:11:29 EDT
Recommend the following to remain consistent with rest of Core validation API. 
Perhaps to reside on org.eclipse.core.runime.Plugin or PluginVersionIdentifier.

IStatus validateVersionIdentifier(String identifier)

Returns an OK status if all is well. Otherwise the returning status object 
will contain the reason(s) why the version identifier is not valid.
Comment 2 Dejan Glozic CLA 2002-04-22 12:49:58 EDT
Looks good to me.
Comment 3 DJ Houghton CLA 2002-05-30 19:03:42 EDT
The method will be on:
  org.eclipse.core.runtime.PluginVersionIdentifier

/**
 * Validates the given string as a plug-in version identifier.
 * 
 * @param version the string to validate
 * @return a status object with code <code>IStatus.OK</code> if
 *		the given string is valid as a plug-in version identifier, 
 *		otherwise a status object indicating what is wrong with 
 *		the string
 * @since 2.0
 */
public static IStatus validateVersion(String version);

Ready to be reviewed and released.
Comment 4 DJ Houghton CLA 2002-05-31 17:09:55 EDT
Released as spec'd above.