Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 369876 - Bug in getFileProxy() when dealing with an unsupported scheme in the URI
Summary: Bug in getFileProxy() when dealing with an unsupported scheme in the URI
Status: RESOLVED FIXED
Alias: None
Product: Linux Tools
Classification: Tools
Component: Project (show other bugs)
Version: unspecified   Edit
Hardware: All Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Linux Distros Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-26 17:34 EST by Corey Ashford CLA
Modified: 2012-05-16 13:54 EDT (History)
2 users (show)

See Also:


Attachments
Fix problem with URI's containing unsupported scheme ids. (1.48 KB, patch)
2012-01-26 17:36 EST, Corey Ashford CLA
no flags Details | Diff
Patch to improve error handling of getFileProxy when passed a URI containing an unsupported scheme id (3.38 KB, patch)
2012-01-30 19:40 EST, Corey Ashford CLA
no flags Details | Diff
RemoteProxyManager: improve error handling of getFileProxy bug (4.69 KB, patch)
2012-05-16 10:05 EDT, Otavio Pontes CLA
obusatto: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Corey Ashford CLA 2012-01-26 17:34:03 EST
Build Identifier: M20110909-1335

If you pass in a URI containing an unsupported scheme id (such as "ftp") into the method RemoteFileProxy#getFileProxy(URI uri), instead of returning a null, it will always silently return the local file proxy. 

Reproducible: Always

Steps to Reproduce:
N/A
Comment 1 Corey Ashford CLA 2012-01-26 17:36:33 EST
Created attachment 210158 [details]
Fix problem with URI's containing unsupported scheme ids.
Comment 2 Jeff Johnston CLA 2012-01-27 20:07:31 EST
(In reply to comment #1)
> Created attachment 210158 [details]
> Fix problem with URI's containing unsupported scheme ids.

Would it not be better to throw a CoreException?  I believe this is how I did it for the CDT RDT branch.
Comment 3 Corey Ashford CLA 2012-01-30 13:22:01 EST
(In reply to comment #2)
> (In reply to comment #1)
> > Created attachment 210158 [details]
> > Fix problem with URI's containing unsupported scheme ids.
> 
> Would it not be better to throw a CoreException?  I believe this is how I did
> it for the CDT RDT branch.

If you'd like all error handling to be done via exception, that's fine with me.

Do you want me to re-write the patch?
Comment 4 Jeff Johnston CLA 2012-01-30 14:30:03 EST
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > Created attachment 210158 [details]
> > > Fix problem with URI's containing unsupported scheme ids.
> > 
> > Would it not be better to throw a CoreException?  I believe this is how I did
> > it for the CDT RDT branch.
> 
> If you'd like all error handling to be done via exception, that's fine with me.
>

Yes.  Otherwise, every call to get proxy managers has to check for null which is tedious.  There already has to be exception handling for using the proxies so it would be a cleaner design.
 
> Do you want me to re-write the patch?

Sure.  The more patches you have accepted, the easier it is to nominate you as a committer.
Comment 5 Corey Ashford CLA 2012-01-30 19:40:09 EST
Created attachment 210294 [details]
Patch to improve error handling of getFileProxy when passed a URI containing an unsupported scheme id

I wrote this patch myself, and I have the permission of my employer to submit it.
Comment 6 Otavio Pontes CLA 2012-05-14 16:34:30 EDT
Is there anything else to change in this patch? I tested this and it is working fine for me. Can you apply it?
Comment 7 Jeff Johnston CLA 2012-05-14 17:02:33 EDT
(In reply to comment #6)
> Is there anything else to change in this patch? I tested this and it is working
> fine for me. Can you apply it?

Just looking at it now, it needs the EPL license added for the new files: Messages.java and messages.properties.

Other than that, it is good to apply as it is <250 lines.
Comment 8 Corey Ashford CLA 2012-05-14 18:18:52 EDT
The changes in this patch are intended to be EPL 1.0.

Would it be OK for Otavio to add the EPL license info into the patch instead of me.  I give him permission to do so, if that's needed, or he can create a new patch with his name on it instead, and include the EPL.  It doesn't matter to me.
Comment 9 Jeff Johnston CLA 2012-05-15 11:41:33 EDT
(In reply to comment #8)
> The changes in this patch are intended to be EPL 1.0.
> 
> Would it be OK for Otavio to add the EPL license info into the patch instead of
> me.  I give him permission to do so, if that's needed, or he can create a new
> patch with his name on it instead, and include the EPL.  It doesn't matter to
> me.

Yes, that would be fine.  Otavio please post the updated patch here.
Comment 10 Otavio Pontes CLA 2012-05-16 10:05:34 EDT
Created attachment 215714 [details]
RemoteProxyManager: improve error handling of getFileProxy bug
Comment 11 Otavio Pontes CLA 2012-05-16 10:06:52 EDT
I updated the patch and it is not creating new files anymore, so it was not necessary to add the epl license. All .java files it changes are already with epl header.
Comment 12 Jeff Johnston CLA 2012-05-16 12:11:49 EDT
(In reply to comment #11)
> I updated the patch and it is not creating new files anymore, so it was not
> necessary to add the epl license. All .java files it changes are already with
> epl header.

Ok, feel free to commit.
Comment 13 Otavio Pontes CLA 2012-05-16 13:07:28 EDT
commit hash: 2bdc917bab72726822bc191f11458a45f00f8a0c