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

Bug 315571

Summary: URIish accepts incorrect URIs
Product: [Technology] JGit Reporter: Dmitry Neverov <dmitry.neverov>
Component: JGitAssignee: Christian Halstrick <christian.halstrick>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: matthias.sohn, stefan.lay
Version: unspecified   
Target Milestone: 1.0.0   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
test to reproduce the problem none

Description Dmitry Neverov CLA 2010-06-03 08:39:15 EDT
URIish currently accept incorrect git URIs and parse whem a little bit wrong. 

For exaple, URIish accepts incorrect URI "ssh://some-host:/path/to/repository.git". It is incorrect because of redundant ':' after the host. 

After that getHost() method returns:

"some-hos"

and getPath() method returns:

"t:/path/to/repository.git".

Test to reproduce the bug is attached.
Comment 1 Dmitry Neverov CLA 2010-06-03 08:39:39 EDT
Created attachment 170944 [details]
test to reproduce the problem
Comment 2 Christian Halstrick CLA 2010-10-01 03:38:07 EDT
I try to fix this with http://egit.eclipse.org/r/#change,1690.

I solved one thing differently. I cannot come up with a URISyntaxException because the syntax is not so bad as we both think. URI's are mainly a scheme, a colon and then a scheme specific part (which can be nearly anything). Not the generic URIish parsing but the ssh specific code can tell that the URI is wrong. So, in my proposal the URI parsing will go through but calling the various "...canHandle()" methods in our transport framework will fail.
Comment 3 Matthias Sohn CLA 2010-10-08 05:14:14 EDT
merged as 2160c09dd4f678c5f2f8e730945be637210b39de