This happened once:

Caused by: java.lang.NullPointerException
        at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2313)
        at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2339)
        at com.jcraft.jsch.ChannelSftp.checkStatus(ChannelSftp.java:1920)
        at com.jcraft.jsch.ChannelSftp.access$200(ChannelSftp.java:36)
        at com.jcraft.jsch.ChannelSftp$1.flush(ChannelSftp.java:708)
        at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
        at 
org.apache.commons.vfs.util.MonitorOutputStream.flush(MonitorOutputStream.java:96)
        at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
        at 
org.apache.commons.vfs.util.MonitorOutputStream.flush(MonitorOutputStream.java:96)
        at java.io.FilterOutputStream.close(FilterOutputStream.java:140)
        at 
org.apache.commons.vfs.util.MonitorOutputStream.close(MonitorOutputStream.java:55)
        at 
org.apache.commons.vfs.provider.DefaultFileContent$FileContentOutputStream.close(DefaultFileContent.java:638)
        at 
org.apache.commons.vfs.provider.FileContentThreadData.closeOutstr(FileContentThreadData.java:104)
        at 
org.apache.commons.vfs.provider.DefaultFileContent.close(DefaultFileContent.java:458)
        at 
org.apache.commons.vfs.provider.AbstractFileObject.close(AbstractFileObject.java:1117)
[...]

As we have a slightly patched .0.1.36 version here's the right line

2309  private int fill(byte[] buf, int s, int len) throws IOException{
2310        int i=0;
2311        int foo=s;
2312        while(len>0){
2313          i=io.in.read(buf, s, len);
2314          if(i<0){
2315            throw new IOException("inputstream is closed");
2316            //return (s-foo)==0 ? i : s-foo;
2317          }
2318          s+=i;
2319          len-=i;
2320        }
2321        return s-foo;
2322      }

Hard to reproduce.

io.in was probably nulled somewhere.

If I remember well, this happens if there's a failure somewhere else
and the main session thread is closed.
But basically the access to io / io.in should be made thread safe.

Cheers,

Jerome

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to