[jcifs] file pointer wrong after readFully in SMBRandomAccessFile

Michael B Allen ioplex at gmail.com
Thu Apr 18 18:54:09 MDT 2013


Hi Stefan and Richard,

Not sure why I missed this before. I have added it to the TODO list and
gave it a high priority. I don't do releases very often though so it might
be a while before it's properly investigated and fixed. But I'll get to it
eventually. Thanks for reporting the issue.

Mike


On Tue, Apr 9, 2013 at 7:48 AM, Stefan Risto <risto at web.de> wrote:

> Richard Heap <richardheap <at> london.com> writes:
>
> >
> >
> >     Hi Mike et alI believe that the file pointer is being
> >           advanced too far following a read fully.For example,
> SmbRandomAccessFile raf = new
> >                   SmbRandomAccessFile(new
> >                                 SmbFile("smb://username:pwd <at>
> server/share/foo/bar/file.dat"),
> >                   "r");
> >                         raf.readFully(new byte[512]);
> >                         System.out.println(raf.getFilePointer());reads
> 512
> bytes but prints 1024. A subsequent read takes
> >                         place at 1024 instead of 512.It looks like
> readFully may be
> >                           incrementing the file pointer as well as
> >                           read(), which is called by
> >                           readFully, causing a double increment.Best
> Regards and thanks again
> >                             for jcifs.Richard
> >
>
>
> I can confirm this issue. I observed the same behaviour. A workaround for
> me
> is to adjust the file pointer manually after every readFully using seek,
> but
> this is very silly.
> Using this workaround I can now open a zip on the smb server and extract a
> single file without streaming the whole zip file to the client (I use a
> patched version of Apache commons compress' ZipFile for that)
>
> Please fix that bug so I can get rid of the workaround.
>
> Regards,
> Stefan
>
>
>
>


-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20130418/3b3d4974/attachment.html>


More information about the jCIFS mailing list