commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom <t...@tbee.org>
Subject Re: FTP findFiles vs FILE bug
Date Tue, 16 Mar 2010 06:28:36 GMT
All I can say: I checked out the code from subversion, put a break point 
in the FTP code, saw "Alfresco/Documents" come in as a parameter, that 
was handed over to the FTPClient and the method returned false to 
indicate an error. In a stand alone test of FTPClient I already noticed 
that handing over a compound path did not work, so I add a split and a 
loop et voila; the code worked.

It may be Alfresco's FTP server, it may be FTPClient, I don't know. But 
this works and it seems like a more compatible implementation.

Tom


On 2010-03-15 22:51, James Carman wrote:
> I don't know if it's a bug or not.  I can access this URL just fine:
>
> ftp://ftp.ncbi.nih.gov/gene/DATA/
>
> And, it has "gene/DATA" off the main server.  So, the CWD stuff
> shouldn't be the problem.  Here's my code:
>
> FileObject baseDir =
> VFS.getManager().resolveFile("ftp://ftp.ncbi.nih.gov/gene/DATA/");
> FileObject[] files = baseDir.getChildren();// baseDir.findFiles(new
> AllFileSelector());
> System.out.println("Found " + files.length + " files!");
>
> It works with either findFiles() or getChildren().
>
> On Mon, Mar 15, 2010 at 5:48 PM, Tom<tbee@tbee.org>  wrote:
>    
>> Naturally the better solution is to patch the changeWorkingDirectory method
>> in the FTPClientWrapper
>>
>> Tom
>>
>>
>>
>> On 2010-03-15 22:44, Tom wrote:
>>      
>>> I found the problem: FTPClient cannot do a changeWorkingDirectory with
>>> multiple directories ("Alfresco/Documents"), you need to take it there
>>> step-by-step: first changeWorkingDirectory to "Alfresco", then
>>> changeWorkingDirectory to "Documents".
>>>
>>> A simple relPath.split("/") with a for loop solves it.
>>>
>>> Tom
>>>
>>>
>>>
>>>
>>>
>>> On 2010-03-15 22:04, Tom wrote:
>>>        
>>>> And last but not least; accessing the FTP server using Apache Commons Net
>>>> FTPClient works fine as well. It really is something VFS does wrong.
>>>>
>>>>     ftp://admin:admin@localhost/Alfresco/Documents
>>>>
>>>>
>>>>
>>>>
>>>> On 2010-03-15 21:23, Tom wrote:
>>>>          
>>>>> Interestingly enough getChilderen() on the FTP returns an empty array,
>>>>> FILE returns the correct childeren, so rewriting it does not help much.
>>>>> Naturally I'm able to connect to the URL using Filezilla and it shows
>>>>> the childeren correctly.
>>>>>
>>>>>
>>>>>
>>>>> On 2010-03-15 17:41, Tom wrote:
>>>>>            
>>>>>>>> On 2010-03-15 16:03, James Carman wrote:
>>>>>>>>                  
>>>>>>>>> Can you not just use getChildren()?
>>>>>>>>>
>>>>>>>>> On Mon, Mar 15, 2010 at 10:54 AM, Tom<tbee@tbee.org>
     wrote:
>>>>>>>>>
>>>>>>>>>                    
>>>>>>>>>> Slowly making progress on using VFS for FTP access
after all kinds
>>>>>>>>>> of
>>>>>>>>>> exception that did not make sense.
>>>>>>>>>>
>>>>>>>>>> Anyhow, I have a tree that shows a directory structure.
If I
>>>>>>>>>> specify
>>>>>>>>>> "file:///..."   the contents of the filesystem is
shown;
>>>>>>>>>> specifically
>>>>>>>>>> findFiles loops into all childeren. If I only replace
this
>>>>>>>>>> with"ftp://..."
>>>>>>>>>> findFiles does no longer loop into its childeren;
it only finds
>>>>>>>>>> itself.
>>>>>>>>>> So
>>>>>>>>>> that means that if I unfold a directory I see the
same directory
>>>>>>>>>> again,
>>>>>>>>>> unfold, same dir, unfold, same dir, ...
>>>>>>>>>>
>>>>>>>>>> Why is the behavior for file: different from ftp:?
>>>>>>>>>> How do I find childeren of an FTP FileObject?
>>>>>>>>>>                      
>>>>>>              
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>>>>> For additional commands, e-mail: user-help@commons.apache.org
>>>>>
>>>>>
>>>>>            
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: user-help@commons.apache.org
>>>>
>>>>
>>>>          
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: user-help@commons.apache.org
>>>
>>>
>>>        
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
>>      
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message