Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [geclipse-dev] Null value for inputstream in gridftp

Hi Romain,

I think thats just a bug and the only way to get the file is by browsing.
I think there are a few more bugs e.g. for me
URI uri = new URI("gsiftp://aliserv6.ct.infn.it:2811/dpm/ct.infn.it/home/geclipsetutor/testtest";); IFileStore fs = EFS.getStore( uri ); IFileStore homeDir = fileSystem.getStore(URI.create("/home/bw/wav/"));
homeDir.copy(fs, EFS.NONE, null);
doesnt work . Have you tested this too and e.g. creation deletion of files?

cheers bernhard


Romain schrieb:
Hi Bernhard,

in fact I don't want to browse the directory before downloading the file. My code should work in a general case for any kind of file server and some like http may not be browsable.

If I try to open an input stream with a direct reference:
IFileStore fi = EFS.getStore(URI.create("gsiftp://grid009.to.infn.it:2811/flatfiles/SE00/biomed/tmp/simexplorer/application18.xml";));
       InputStream str = fi.openInputStream(EFS.NONE, null);
       if(str == null) System.out.println("null");

The result of this code is null.

Romain

bewind a écrit :
Hi  Romain

This may help -> http://dev.eclipse.org/mhonarc/lists/geclipse-dev/msg01200.html

I just tested to up and download a file and it was successful.

URI uri = new URI("gsiftp://aliserv6.ct.infn.it:2811/dpm/ct.infn.it/home/geclipsetutor/upanddown/";); IFileStore fs = EFS.getStore( uri ); IFileStore file1 = null; for (IFileStore store : fs.childStores(EFS.NONE,null)) {
             if ( store.getName().equals("test.wav") ) {
               file1 = store;
               System.out.println(file1.getName() );
               break;
             }
           }
File a = new File("/home/bw/test.wav"); BufferedOutputStream ostream = new BufferedOutputStream(file1.openOutputStream(EFS.OVERWRITE, null)); BufferedInputStream istream = new BufferedInputStream(new FileInputStream(a)); int b1;
           do {
b1=istream.read(); ostream.write(b1); } while(b1!=-1); File bla = new File("/home/bw/foofoo.wav");
          ostream = new BufferedOutputStream(new FileOutputStream(bla));
istream = new BufferedInputStream(file1.openInputStream(EFS.NONE,null)); do { b1=istream.read(); ostream.write(b1); } while(b1!=-1);
         ostream.close();
         istream.close();


I tested to upload the content of a directory but it just created the dir testtest and a file with size 0B (it should be a soundfile) then exceptions occure.

URI uri = new URI("gsiftp://aliserv6.ct.infn.it:2811/dpm/ct.infn.it/home/geclipsetutor/testtest";); IFileStore fs = EFS.getStore( uri ); IFileStore homeDir = fileSystem.getStore(URI.create("/home/bw/wav/"));
homeDir.copy(fs, EFS.NONE, null);

org.eclipse.core.runtime.CoreException: This file system is read only: gsiftp://aliserv6.ct.infn.it:2811/dpm/ct.infn.it/home/geclipsetutor/up/aest.wav.
   at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:55)
   at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:50)
at org.eclipse.core.filesystem.provider.FileStore.putInfo(FileStore.java:423) at org.eclipse.core.filesystem.provider.FileStore.transferAttributes(FileStore.java:458) at org.eclipse.core.filesystem.provider.FileStore.copyFile(FileStore.java:218) at org.eclipse.core.filesystem.provider.FileStore.copy(FileStore.java:140) at org.eclipse.core.internal.filesystem.local.LocalFile.copy(LocalFile.java:93) at org.eclipse.core.filesystem.provider.FileStore.copyDirectory(FileStore.java:177) at org.eclipse.core.filesystem.provider.FileStore.copy(FileStore.java:138) at org.eclipse.core.internal.filesystem.local.LocalFile.copy(LocalFile.java:93)
   at jobsubmission.Application.start(Application.java:266)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
   at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
   at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
   at org.eclipse.equinox.launcher.Main.main(Main.java:1148)

Maybe created with the wrong rights.
Are you able to up and download files?

greetz bernhard


Romain schrieb:
Hi everybody,

I have got a probleme with (getFileStore() IFileStore to gsiftp url)

getFileStore().openInputStream(EFS.NONE, null);

This method allways return null.

The method

getFileStore().openOutputStream(EFS.NONE, null);

works like a charm. I manage to write strings inside one file, but if I try to open an inputstream to this file I get a null pointer!

Cheers,
Rom.
_______________________________________________
geclipse-dev mailing list
geclipse-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/geclipse-dev


_______________________________________________
geclipse-dev mailing list
geclipse-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/geclipse-dev

_______________________________________________
geclipse-dev mailing list
geclipse-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/geclipse-dev




Back to the top