[jcifs] getType question

Michael B. Allen miallen at eskimo.com
Tue Dec 17 20:52:26 EST 2002


On Tue, 17 Dec 2002 10:24:45 +0100
andrea.lanza at frameweb.it wrote:

> >> Another question: is it a way to check if I have the rigth to read a
> file,
> >> or do I have to check for the SMBException after trying to read it ?
> >>
>  >The canRead() method will return a value based on the file's attributes.
>  If the file
>  >is locked by another process the canRead method will not consider that in
>  which
>  >case when trying to read it will result in an SmbException of "The file
>  is being
>  >accessed by another process".
> 
>  I tried to use the canRead() method with no result.
> 
>  more specifically, i would like to do this:
>  When I browse a network computer, using my credential, and this computer
>  is part of my domain, I see its shares (IPC$ C$ d$ and so on)
> 
>  But it is very reasonable that I cannot access a lot of them, becouse I am
>  not listed in the ACL (FileSystem ACL Level) with the read (or list)
>  rigth.
>  So it could be fine for me to put a "symbol" near to this share listed,
>  meaning no access to this.
>  If I try to access this I get the rigth exception (
>  jcifs.smb.SmbAuthException: Access denied)
> SO: do I have to use this way (specific exception trapping ?)

Ah, yes. Shares do not have attributes like files so there is a fair
amount of guessing going on. Same for servers and workgroups. The only
way to know if they are accessable is to try. Beware however, this is
time consuming to issue a request for each share and throw the exception
so I would not do it unless the user explicitly provokes it or you know
they need it.

> 
> 
> >> thanks in advance,
> >> Andrea
> >>
> >>
> 
> 
> new question !!
> since I installed last version I see a lot of
> sem.count=2,q1x.ans=null,q20.ans=null
> sem.count=1,q1x.ans=null,q20.ans=null
> sem.count=2,q1x.ans=null,q20.ans=null
> sem.count=1,q1x.ans=null,q20.ans=null
> 
> in my stdout file
> I think it could be some debugging information "forgotten" here. Is it
> correct ?

No this is not correct. There is an uncommented debugging println at
src/jcifs/UniAddress.java:173. It's not the first time ;->

> I think they are generated from the listFiles() method (not sure)

This will be triggered by listing workgroups. I think I'm going to have
to let that slide a few....

> 
> Andrea
> 
> 
> 


-- 
A  program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes  the  potential  for it to be applied to tasks that are
conceptually  similar and, more important, to tasks that have not
yet been conceived. 



More information about the jcifs mailing list