[jcifs] NullPointer exceptions

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Wed Jan 9 10:38:00 EST 2002


> -----Original Message-----
> From:	Shawn Carnahan [SMTP:Shawn_Carnahan at Telestream.net]
> Sent:	Tuesday, January 08, 2002 6:07 PM
> To:	'jcifs at lists.samba.org'
> Subject:	[jcifs] NullPointer exceptions
> 
> Mike: 
> 
> We've been using the JCIFS client to periodically scan network file systems. On 0.6b6 we have noticed several unhandled NullPointerExceptions when a remote server is powered down or rebooted,
> specifcally, in SmbTransport.tryClose() the socket is null when you try to close it, here's the call stack:
> 
> SmbFile.exists() 
> SmbFile.updateAttributes() 
> SmbFile.queryPath() 
> SmbTransport.negotiate() 
> SmbTransport.send() 
> SmbTransport.tryClose(inError = true) 
> 
	Opsee! Maybe this is better ...

	    277     void tryClose( boolean inError ) {
	                  if( socket == null ) {
	                      inError = true;
	                  }
	    278         for( Enumeration e = sessions.elements(); e.hasMoreElements(); ) {
	    279             ((SmbSession)e.nextElement()).logoff( inError );
	    280         }
	                  if( socket != null ) {
	    281             try {
	    282                     socket.close();
	    283             } catch( IOException ioe ) {
	    284             }
	                  }
	    285         in = null;
	    286         out = null;
	    287         socket = null;
	    288         negotiated = false;
	    289         thread = null;
	    290         responseTable.clear();
	    291     }


> Also for those of us stuck with 1.1, is it the intent to maintain 1.1 compatibility in 0.6? The java.net.URLDecoder class was the only exception I ran across in upgrading.
> 
	Yes, I didn't realise 1.1 didn't have URLDecoder. I'll just copy that class into the jcifs.util package.

> Thanks, 
> 
> Shawn Carnahan 
> 
	Thanks for the feedback,
	Mike






More information about the jcifs mailing list