commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J-Pro <jpro....@gmail.com>
Subject Re: [VFS] The same "FileObject.exist()" call returns different values in Windows 7 and Linux Ubuntu while connected to simple FTP
Date Wed, 06 Oct 2010 19:28:50 GMT
  Thanks God somebody answered my question :) Thanks, Steven!

Answering your questions:

   1. Yes, destination(actually, it's source, because I take file from
      there) server remains the same, it's Windows 7 x64 Enterprise. FTP
      Server is "Gene6 FTP Server v3.10.0".
   2. Yes, the only thing I change - the OS where I'm launching my
      application. I just take the JAR, put it in different OS and run
      it from console(java -jar myapp.jar) - that's all.
   3. About the file name, I'm sorry, it's my mistake, because in the
      listing it's wrong(I've took it from another place in the code).
      The file I'm trying to check for is "test.txt.asc.pgp" as I
      mentioned when specified FTP address. Forget about this long file
 
name(",AMCPROD,derivative_pricing_ssb_cds_20100910_00.xml.pgp,U,20100910A00012022189.txt"),
      I don't use it. Sorry for this mistake. So my correct listing is:

        String fileName =  "test.txt.asc.pgp";
        FileSystemManager fsManager = VFS.getManager();
        UserAuthenticator auth = new StaticUserAuthenticator(null,
        "login", "password");
        FileSystemOptions srcOpts = new FileSystemOptions();
        String sourceDirAsString = "ftp://HOSTNAME:22221/alex";
 
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(srcOpts,
        auth);
        FileObject sourceDir = this.fsManager.resolveFile(dirAsString,
        opts);
        FileObject neededFile = sourceDir.resolveFile(fileName);
        return neededFile.exists();


If you need any more additional information, please ask, I'll give it to 
you.

Thank you very much in advance.



On 06.10.2010 21:16, Steven Siebert wrote:
> Hey JPro....I'll take a look at this tonight.
>
> If I understand correctly, the destination server remains the same
> between both calls (what OS is the destination server?).  The only
> thing you are changing is the client your running your app on?
>
> Please confirm the name of the file you are trying to download is:
> ",AMCPROD,derivative_pricing_ssb_cds_20100910_00.xml.pgp,U,20100910A00012022189.txt"?
> With a leading comma (,)?
>
> Are you using the DefaultFileSystemManager, or have you done anything
> special in this area?  I assume for the **dir initialization** you are
> asking something like:
>  dir = VFS.getManager().resolveFile(endpointURI[, FileSystemOptions]);
>
>
> Regards,
>
> Steve
>
> On Tue, Oct 5, 2010 at 12:58 PM, J-Pro <jpro.swt@gmail.com
> <mailto:jpro.swt@gmail.com>> wrote:
>
>      Sorry for bothering, almost a week since posting... Does anyone
>     knows the reason or faced the same anytime?
>
>     Thanks.
>
>
>     On 30.09.2010 22:54, J-Pro wrote:
>
>          Good afternoon.
>
>         Today I've found an interesting thing in VFS. I've spent 4
>         hours testing it in different situations. It looks like a bug,
>         but I want to ask all of you first.
>
>         My code uses VFS to connect to FTP (simple FTP, but on port
>         22221) and copy a file from
>         there(ftp://HOSTNAME:22221/alex/test.txt.asc.pgp). But before
>         copying I'm checking if the file exists using FileObject's
>         method "exist()".
>         The thing is that when I run my JAR from command line of
>         Windows 7, "exist()" returns true. But if only I run the same
>         JAR from Linux Mint 9 Isadora(2.6.32-21-generic), this method
>         returns false.
>         I've made a test and found out that if I change port from
>         22221 to simple 21, JAR runs fine on both systems, i.e.
>         "exist()" returns true. This strange thing in Linux happens
>         only when I use port number 22221.
>
>         Please tell me is it my error somewhere or is it really some
>         kind of a bug?
>
>         My code for checking if the file exists is:
>
>           FileObject dir = null;
>           String fileName =
>
>         ",AMCPROD,derivative_pricing_ssb_cds_20100910_00.xml.pgp,U,20100910A00012022189.txt";
>           // .... dir initialization
>           FileObject neededFile = dir.resolveFile(fileName);
>           return neededFile.exists();
>
>         Thank you very much in advance.
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>     <mailto:user-unsubscribe@commons.apache.org>
>     For additional commands, e-mail: user-help@commons.apache.org
>     <mailto: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