[jcifs] BUG: SmbFileInputStream.read()

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Thu Feb 21 14:50:51 EST 2002


I would have to find a serious bug right after doing the big release :~/

If you read a file using SmbFileInputStream and the files size is precisely a
multiple of 4096 and the read buffer is larger than 4096 and it's larger than
the entire file the read() function will return -1.

Here's a patch, I'll release 0.6.1 in a few hours.

--- jcifs_0.6.0.orig/src/jcifs/smb/SmbFileInputStream.java      Wed Feb 20 05:09:31 2002
+++ jcifs_0.6.0/src/jcifs/smb/SmbFileInputStream.java   Wed Feb 20 22:42:37 2002
@@ -144,9 +144,7 @@
                                }
                                throw se;
                        }
-                       if(( n = response.dataLength ) <= 0 ) {
-                               return -1;
-                       }
+                       n = response.dataLength;
 //System.out.println( "n=" + n );
                        fp += n;
                        len -= n;








More information about the jcifs mailing list