[jcifs] Strange issue with SmbFileInputStream

Michael B Allen ioplex at gmail.com
Wed Jan 27 10:04:31 MST 2010


Hi Rene,

Wait a while to make sure it is really hanging. If it does not respond
after a few minutes, get a thread-dump using Ctrl-Break on Windows or
Ctrl-\ on Unix in a console. That will show you exactly where it's
stuck.

Mike

On Wed, Jan 27, 2010 at 11:35 AM, René Liebmann
<rene_liebmann at datamatics.de> wrote:
> Hi all,
>
>
>
> I have a small function which I use to copy a remote file to my local
> machine. On almost all environments (Win XP Home) this works fine, but on a
> Windows 2003 Server environment it does only copy a small portion of a file
> e.g. if the file is 6 MB large it copies 248 kB. Then it seems that it never
> leaves the while block and my program hangs. It does not throw any
> exception. What am I doing wrong?
>
>
>
> private void copySmbFileTo(SmbFile f, String location) throws IOException {
>
>         logger.debug(name + " enter function copySmbFileTo "+f.getUncPath()
> + " to "+location);
>
>
>
>         SmbFileInputStream istr = null;
>
>         OutputStream ostr = null;
>
>         try {  // 1
>
>             istr = new SmbFileInputStream(f);
>
>             ostr = new FileOutputStream(location);
>
>             byte[] buf1 = new byte[1024];
>
>             int len1;
>
>             while((len1 = istr.read(buf1)) > 0){
>
>                 ostr.write(buf1, 0, len1);
>
>             }
>
>             ostr.flush();
>
>         } catch(Exception ex){
>
>             logger.error("", ex);
>
>         } finally{
>
>           try { // 2
>
>             if(istr!=null)  istr.close();
>
>             if(ostr!=null)  ostr.close();
>
>           } catch(Exception ex){
>
>               logger.error("Major Error Releasing Streams:", ex);
>
>
>
>           } // End try catch number 2
>
>         } // End try catch finally number 1
>
>         logger.debug(name + " leave function copySmbFileTo");
>
>
>
>     }
>
>
>
> Thanks for your ideas in advance
>
>
>
> René
>
>



-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/


More information about the jCIFS mailing list