[jcifs] renameTo

Michael B Allen mba2000 at ioplex.com
Mon May 22 18:55:56 GMT 2006


On Mon, 22 May 2006 13:10:33 -0400
roy-jcifs at xemaps.com wrote:

> Hello,
> 
> Just a few questions. 
> 
> Is SmbFile.renameTo atomic?  
> Does it return after a successful rename or does it spawn a thread and return right away?  

No jcifs methods have asyncronous behavior. The closest thing would be
SmbFile.copyTo which employs another thread to write while the original
thread is reading (or it's the other way around, I can't recall) but
the method still doesn't actually return until the copy is complete or
an exception occurs.

> 
> The javadoc is also confusing since the actual method returns void, but the javadoc says that a boolean will be returned.  Is the intended behavior supposed to return a boolean?  Will it not throw an SmbException if the rename failed?

That's just a bug in the docs. SmbFile.renameTo does not return a value.
If the rename fails an Exception is thrown.

Mike


More information about the jcifs mailing list