[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [geclipse-dev] EFS openInputStream
|
Hi Matze
You are my god!
Yes the lazy developer (I will look for him the next time
I'm in front of a mirror! :-) ) did not set the length of the
file to download and that forced the damage!
Cool remote analysis without source code!
Harald
>>-----Original Message-----
>>From: geclipse-dev-bounces@xxxxxxxxxxx
>>[mailto:geclipse-dev-bounces@xxxxxxxxxxx] On Behalf Of
>>Stuempert, Mathias IWR
>>Sent: Thursday, November 05, 2009 9:02 PM
>>To: Developer mailing list
>>Subject: AW: [geclipse-dev] EFS openInputStream
>>
>>Hi Harald,
>>
>>Unfortunately I have no sources available. But let me try to
>>reconstruct them from memory ;-)
>>
>>The CachedInputStream is used by the gecl-FS internally to
>>allow opening remote files in a standard Eclipse editor which
>>requires the whole content of a file to be immediately
>>available at opening time. Therefore it fetches the whole
>>file content before the Open Action itself actually takes
>>place. A HeapByteBuffer is used internally to store the file
>>content. In order to correctly allocate this HeapByteBuffer
>>the CachedInputStream needs to know the size of the file. The
>>size of the file is retrieved via the IFileStore's IFileInfo-Object.
>>
>>Now it is far too often the case that developer's are too
>>lazy to fully implement their EFS-Implementation before
>>they're trying to do fancy things with it :-P So if they are
>>implementing IFileStore correctly but are forgetting about
>>parts of IFileInfo ... then things like what you described
>>are happening.
>>
>>So just a guess, but is it possible that your
>>IFileInfo#getLength() does return 0 or at least a number that
>>is smaller than the actual length of your String (which is
>>your file content)?!
>>
>>Cheers, Mathias
>>
>>
>>-----Ursprüngliche Nachricht-----
>>Von: geclipse-dev-bounces@xxxxxxxxxxx im Auftrag von Harald Kornmayer
>>Gesendet: Do 05.11.2009 11:08
>>An: Developer mailing list
>>Betreff: [geclipse-dev] EFS openInputStream
>>
>>Hi all
>>
>>I try to connect to another Cloud file system. So I started
>>to implement the Cloud file system using EFS.
>>The first draft works partly:
>>1. I can create the connection
>>2. I can browser through the hierarchy of the File System.
>>The file system is in fact like AWS S3 or GRIA.
>>ONe has a bucket/container and a list of files under the container.
>>
>>3. When I try to (over-) write the openInputStream the file,
>>I can get the content as a String. There is not
>>getInputStream method available from the API. Then I do the
>>following:
>>
>>
>>InputStream value = null ;
>>Inp....
>>Inputt Stream value = null ;
>>...
>>String result = (use API used to get the String. I can dump
>>it to the screen!!) value = new
>>ByteArrayInputStream(result.getBytes());
>>
>>return value ;
>>
>>When doing so, I can not open the editor, as I got the
>>following message:
>>
>>java.nio.BufferOverflowException
>>at java.nio.HeapByteBuffer.put(Unknown Source) at
>>eu.geclipse.core.filesystem.internal.filesystem.CachedInputStr
eam.cache(CachedInputStream.java:123)
>>at
>>eu.geclipse.core.filesystem.internal.filesystem.GEclipseFileSt
ore.cacheInputStream(GEclipseFileStore.java:208)
>>at
>>eu.geclipse.core.filesystem.internal.filesystem.ConnectionElem
ent.getCachedConnectionFileStore(ConnectionElement.java:165)
>>at
>>eu.geclipse.ui.internal.actions.OpenFileAction$1.run(OpenFileA
>>ction.java:171)
>>at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>>
>>
>>Any idea??
>>Matheusz, Mathias, Thomas, ...
>>
>>Harald
>>
>>
>>_______________________________________________
>>geclipse-dev mailing list
>>geclipse-dev@xxxxxxxxxxx
>>https://dev.eclipse.org/mailman/listinfo/geclipse-dev
>>