Re: jcifs.smb.SmbException: The handle is invalid.
Shon Vella <[email protected]> Mon, 6 Jan 2014 07:36:58 -0700
| Newsgroups | gmane.network.samba.java |
|---|---|
| Message-ID | <[email protected]> |
If you’ve got stuff going on concurrently in multiple threads, it could also be related to this: http://article.gmane.org/gmane.network.samba.java/9353 Also wondering if maybe that megabyte buffer you are using could be an issue. Shon Vella Developer iDENTiTYAUTOMATiON www.identityautomation.com Direct: 281-220-0021 Ext: 2030 On Jan 6, 2014, at 12:08 AM, Michael B Allen <[email protected]> wrote: > On Thu, Nov 28, 2013 at 9:04 AM, btandel <[email protected]> wrote: >> I am getting jcifs.smb.SmbException: The handle is invalid while copying >> a file. This error occurs in the middle of copying. >> >> SmbFileInputStream fin = null; >> SmbFile file = new SmbFile("path"); >> fin = new SmbFileInputStream(file); >> >> FileOutputStream fos = null; >> File tmpFile = File.createTempFile("fileName", "docextention"); >> try >> { >> fos = new FileOutputStream(tmpFile); >> byte[] b = new byte[1048576]; >> int count = 0; >> while ((count = fin.read(b)) > 0) >> { >> fos.write(b, 0, count); >> } >> // System.out.println("fos" + fos.toString()); >> } >> catch (Exception e) >> { >> logger.error(e.getMessage()); >> new ExceptionHandler().exceptionMail(e); >> } >> >> Error is generated from line : while ((count = fin.read(b)) > 0) >> >> jcifs.smb.SmbException: The handle is invalid. >> <br> at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:563) >> <br> at jcifs.smb.SmbTransport.send(SmbTransport.java:663) > <snip> > > Hi btandel, > > The "handle is invalid" error is coming from the server. This is the > sort of error you might get if the file was deleted from the server > while you were in the middle of reading it. > > Mike > > -- > Michael B Allen > Java Active Directory Integration > http://www.ioplex.com/