[jcifs] canRead always returning false

rjw rob at wygand.com
Thu Dec 13 14:51:40 EST 2001


Yeah, false. I did some more poking, and saw it all the time when using 
Samba as the file server, but it seemed okay using WinNT 4.0... so I'm 
going to do some more debugging.

Noted on doing the op first, though that gave me some strange behavior. 
For instance, the 1st time I tried to access a file I did not have 
access to I got an Access Denied SmbException. The second time I tried, 
the operation worked! Again, I have some more debugging to do here...

rjw

Allen, Michael B (RSCH) wrote:

> 
>>-----Original Message-----
>>From:	Rob Wygand [SMTP:rob at filefish.com]
>>Sent:	Wednesday, December 12, 2001 7:46 PM
>>To:	jcifs at samba.org
>>Subject:	[jcifs] canRead always returning false
>>
>>Mike,
>>
>>Found something new today. It looks like SmbFile.canRead() is always 
>>returning false.
>>
>>
> 	False? That's very strange. From looking at the code I don't see how it's possible. It should return true if the file exists or throw an SmbException.
> 
> 
>> I can subsequently make an SmbFileInputStream() from 
>>the file, but I usually check canRead() first so that I can cleverly 
>>show the user some nice error message.
>>
>>
> 	You should just try and do the operation and then show the user the message associated with any exception that occurs. Calling canRead give you nothing and costs an extra round trip to the
> server.
> 
> 
>>Have you seen this?
>>rjw
>>
>>
>>
> 


-- 
Robert J. Wygand, III, D.D.                  rob at wygand.com
GPG  [A267 C8F7 34C2 2896 20F3]  [7DC8 2605 9E4C 573A 20EC]

"They that can give up essential liberty to obtain a little
  temporary safety deserve neither liberty nor safety."





More information about the jcifs mailing list