Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 300900

Summary: [director] Improve error message when passing url instead of version
Product: [Eclipse Project] Equinox Reporter: John Arthorne <john.arthorne>
Component: p2Assignee: Pascal Rapicault <pascal>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: irbull, pascal, thomas
Version: 3.6Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description John Arthorne CLA 2010-01-26 14:29:22 EST
I20100126-0100

From the command line do the following (I misinterpreted the meaning of the -list argument):

eclipsec.exe -application org.eclipse.equinox.p2.director -list http://download.eclipse.org/releases/helios

This produces the following error:

!ENTRY org.eclipse.osgi 4 0 2010-01-26 14:16:34.671
!MESSAGE Application error
!STACK 1
java.lang.IllegalArgumentException: Neither raw version nor format was specified: download.eclipse.org
	at org.eclipse.equinox.internal.p2.metadata.VersionParser.parse(VersionParser.java:167)
	at org.eclipse.equinox.p2.metadata.Version.create(Version.java:78)
	at org.eclipse.equinox.p2.metadata.Version.parseVersion(Version.java:153)
	at org.eclipse.equinox.internal.p2.metadata.VersionedId.<init>(VersionedId.java:58)
	at org.eclipse.equinox.internal.p2.metadata.VersionedId.parse(VersionedId.java:45)
	at org.eclipse.equinox.internal.p2.director.app.DirectorApplication.parseIUsArgument(DirectorApplication.java:159)
	at org.eclipse.equinox.internal.p2.director.app.DirectorApplication.processArguments(DirectorApplication.java:564)
	at org.eclipse.equinox.internal.p2.director.app.DirectorApplication.run(DirectorApplication.java:725)
	at org.eclipse.equinox.internal.p2.director.app.DirectorApplication.start(DirectorApplication.java:872)
Comment 1 Thomas Hallgren CLA 2010-01-26 15:01:06 EST
The URL Is sent to the VersionId.parse function which simply splits it into segments using '/'. Segment 0 is then assumed to be an id and segment 1 a version. We should have sanity checks:

1. The number of segments must be 1 or 2.
2. If the second segment is present, it has to be a valid version.

and then instead throw an IllegalArgumentException(NLS.bind("''$0'' is not a valid id/version", spec).

That would give the user a better hint then the current message.

Perhaps the first segment should somehow be checked for validity. But that begs the question, what is a valid IU id?
Comment 2 John Arthorne CLA 2010-01-26 15:09:32 EST
Yes the exception makes sense, this bug is really about reporting something nicer to the user. Currently I get an error dialog saying "An error has occurred. See the log file for details". Instead I should see something on stdout saying something like "{0} is not a valid version number", as you suggest.
Comment 3 Eclipse Genie CLA 2019-05-01 14:25:24 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.