Bug 224538 - [efs] RSEFileStore.getParent() returns null for element which is not root of filesystem
Summary: [efs] RSEFileStore.getParent() returns null for element which is not root of ...
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 RC1   Edit
Assignee: Martin Oberhuber CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: contributed, helpwanted
Depends on:
Blocks:
 
Reported: 2008-03-28 03:47 EDT by Timur Shipilov CLA
Modified: 2011-05-25 07:32 EDT (History)
0 users

See Also:


Attachments
This patch fixed problem for me (14.48 KB, patch)
2008-03-28 03:59 EDT, Timur Shipilov CLA
no flags Details | Diff
New one (1.51 KB, patch)
2008-03-28 05:24 EDT, Timur Shipilov CLA
mober.at+eclipse: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Timur Shipilov CLA 2008-03-28 03:47:45 EDT
Build ID: I20070625-1500

Steps To Reproduce:
URI uri = RSEFileSystem.getURIFor("MYHOST", "/home/user");
IFileStore store = EFS.getStore(uri); // RSEFileStore returned
// This is not root of remote file system, so one can 
// expect following to be true, but it isn't
Assert.isTrue(root.getParent() != null);


More information:
Comment 1 Timur Shipilov CLA 2008-03-28 03:59:59 EDT
Created attachment 93941 [details]
This patch fixed problem for me
Comment 2 Martin Oberhuber CLA 2008-03-28 05:10:06 EDT
Thanks for the patch, but I have a few comments:

1. I'm not too happy about all the reformatting you did. It makes reviewing
   the patch much harder for me, because I need to sort out what was just
   a reformatting and what was actual change of functionality. Either please
   avoid reformatting, or contribute plain reformatting-only separately from
   a feature or bugfix contribution.
   Technically, what I propose is you do Team > Synchronize of your contribution
   and then try to reduce the patch to feature/bugfix contribution only.

2. You get the parent file store in the Constructor. I think that this is a 
   bad idea since it may impact performance even if the parent is never needed.
   Impact could in fact be VERY BIG because for a deeply nested path, the
   parent(s) will be computed recursively.
   The parent should be computed lazily in the getParent() method instead.

3. When making a contribution, please update the Copyright header as well 
   adding your name under "Contributors" and updating copyright year if 
   necessary.

4. Ideally, a bugfix like yours should come with a unit test to secure the
   fix. In this case, the test could simply use EFS for the RSE "Local" 
   file system which would always work.

5. We need a legal statement from you with your contribution, where you certify
   that you developed the code yourself and your employer is ok with the 
   contribution. This statement should be attached here on bugzilla as a 
   comment. A template is on 
   http://www.eclipse.org/dsdp/tm/development/committer_howto.php#external_contrib

All that being said, it's great that you discovered the issue and did come up with a patch. I'd really appreciate if you could also go the extra mile and try it again with a lazy implementation in getParent(), starting from the original RSEFileStore(Impl)? without reformattings.

Thanks!
Comment 3 Martin Oberhuber CLA 2008-03-28 05:11:40 EDT
Assigning target milestone M7 since I won't have much time left for M6. We could do M6 if a great patch including unit tests is contributed.

PS we'll set the "contributed" keyword only once the patch has been committed to CVS. Before that, we'll find the patch with other bugzila queries, see
http://www.eclipse.org/dsdp/tm/development/bug_process.php
Comment 4 Timur Shipilov CLA 2008-03-28 05:24:57 EDT
Created attachment 93953 [details]
New one

I, Timur Shipilov, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer to make this contribution under the EPL.
Comment 5 Martin Oberhuber CLA 2008-03-28 05:38:15 EDT
Much better, thanks!

Now if you could also come up with a Unit test I'd be really happy for today :-) Note that *I* will set the "contributed" keyword once this is checked in to CVS.

Is the official company name of your employer "Xored" or "Xored Software"? - The latter is what your fellow contributors Mikhail Kalugin and Ruslan Sychev have been using so far.
Comment 6 Timur Shipilov CLA 2008-03-28 05:48:32 EDT
Xored Software Inc. ;)
Comment 7 Martin Oberhuber CLA 2008-05-05 17:30:51 EDT
Not for M7
Comment 8 Martin Oberhuber CLA 2008-05-20 16:46:37 EDT
Patch applied, thanks -- 6 lines of code.