<p>Hi All, </p>
<p>we encountered the same problem as Dora reported <a href="https://lists.samba.org/archive/jcifs/2012-January/009856.html">https://lists.samba.org/archive/jcifs/2012-January/009856.html</a> with jcifs-1.3.16 in a different usage scenario. We have a component that periodically polls a remote directory with listFiles. The NullPointerException occurs irregularly during the day but quite often about every 5-10 minutes. We figured out, that the root cause was an I/O Exception due to timeout on the socket transport level, probably because the remote server has not responded or the network connection failed. As Mike mentioned in his post, there is a problem in jcifs implementation that tconHostName is explicitly set to null, when a transport exception is thrown. On a reconnect attempt in Dfs.resolve() the NPE is thrown, because tconHostName is null. </p>

<p>The following patch fixed the problem for us. We changed the finally block to not clear tconHostName and added code to the constructor to ensure, that  it always contains a valid hostname.</p>
<p>Index: C:/Documents and Settings/kjr130/My Documents/Downloads/jcifs_1.3.16.orig/jcifs-1.3.16.orig/src/jcifs/smb/SmbTransport.java <br>
=================================================================== <br>
--- C:/Documents and Settings/kjr130/My Documents/Downloads/jcifs_1.3.16.orig/jcifs-1.3.16.orig/src/jcifs/smb/SmbTransport.java        (revision 632) <br>
+++ C:/Documents and Settings/kjr130/My Documents/Downloads/jcifs_1.3.16.orig/jcifs-1.3.16.orig/src/jcifs/smb/SmbTransport.java        (working copy) <br>
@@ -114,6 +114,9 @@ <br>
         this.port = port; <br>
         this.localAddr = localAddr; <br>
         this.localPort = localPort; <br>
+        if (address != null) { <br>
+                this.tconHostName = address.getHostName(); <br>
+        } <br>
     } <br>
  <br>
     synchronized SmbSession getSmbSession() { <br>
@@ -371,7 +374,7 @@ <br>
         } finally { <br>
             digest = null; <br>
             socket = null; <br>
-            tconHostName = null; <br>
+//            tconHostName = null; <br>
         } <br>
     } </p>
<p>I would greatly appreciate, if you could include this fix into upcoming jcifs releases. </p>
<p>Thanks. </p>
<p>Gabor <br>
</p>