Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317606 - CVSURI can't parse a supported format
Summary: CVSURI can't parse a supported format
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: CVS (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: platform-cvs-inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-22 11:25 EDT by Matthew Piggott CLA
Modified: 2021-11-01 06:26 EDT (History)
1 user (show)

See Also:


Attachments
Removes // from scheme specific part of URI (895 bytes, text/plain)
2010-06-22 11:25 EDT, Matthew Piggott CLA
no flags Details
JUnit test v01 (1.31 KB, patch)
2010-06-23 12:06 EDT, Tomasz Zarna CLA
no flags Details | Diff
mylyn/context/zip (77.38 KB, application/octet-stream)
2010-06-23 12:06 EDT, Tomasz Zarna CLA
no flags Details
Test case (1.54 KB, patch)
2010-06-24 10:40 EDT, Matthew Piggott CLA
no flags Details | Diff
Test case v03 (2.08 KB, patch)
2010-06-24 11:35 EDT, Tomasz Zarna CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Piggott CLA 2010-06-22 11:25:41 EDT
Created attachment 172429 [details]
Removes // from scheme specific part of URI

In the documentation for CVSURI.fromURI the format: 

* cvs://[:]method:user[:password]@host:[port]/root/path#project/path[,tagName]

is described, however if the method is called with a URI of this format a NullPointerException is thrown.  Through debugging I found the exception occurs because the // is not removed from the scheme specific part and an attempt is made to find a handler for // rather than pserver, extssh, etc. which occur afterwards.  I've attached a patch which removes the // from the scheme specific which fixes the problem.
Comment 1 Tomasz Zarna CLA 2010-06-23 12:02:27 EDT
Matthew could you provide a failing unit test for a CVSURI that cannot be parsed? This should be straightforward, just take a look at /org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/CVSURITest.java.
Comment 2 Tomasz Zarna CLA 2010-06-23 12:06:17 EDT
Created attachment 172522 [details]
JUnit test v01

After having a quick look at the CVSURI code, my first impression was that the case you're referring to is the one where password contains '/' character. When running the tests it does fail, but unfortunately your patch doesn't fix it. 

Feel free to modify this patch to fit your case.
Comment 3 Tomasz Zarna CLA 2010-06-23 12:06:21 EDT
Created attachment 172523 [details]
mylyn/context/zip
Comment 4 Matthew Piggott CLA 2010-06-24 10:40:05 EDT
Created attachment 172619 [details]
Test case

Here is a test case for the problem; in your test you're using the URI of the other format type.  If you open the CVS perspective or repository view, right click on any of the connections then Copy to Clipboard.  If you prefix it with cvs:// that is the base URI its just missing a path.

Another note, if the URI doesn't have a fragment (used for the path) the method will also throw a NullPointerException.  The javadoc doesn't describe the fragment as optional, but perhaps it should default to the root path?
Comment 5 Tomasz Zarna CLA 2010-06-24 11:35:21 EDT
Created attachment 172627 [details]
Test case v03

Well, if the javadoc doesn't say the fragment is optional, getting a NPE when it's not provided is kinda expected, isn't?

I updated your test case (thanks btw). If you're fine with the changes I will commit both test and the fix you suggested.
Comment 6 Eclipse Webmaster CLA 2019-09-06 15:30:56 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.
Comment 7 Eclipse Genie CLA 2021-11-01 06:26:18 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.