You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/12/03 16:46:10 UTC

DO NOT REPLY [Bug 25167] New: - NullPointerException in SocketClient.getRemoteAddress()

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25167>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25167

NullPointerException in SocketClient.getRemoteAddress()

           Summary: NullPointerException in SocketClient.getRemoteAddress()
           Product: Commons
           Version: 1.1.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Net
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: patrick_conant@yahoo.com


Description: java program running overnight.  Unknown network conditions caused
a NullPointerException in the SocketClient class.  The client had previously
been connected to a remote host.  There was not a programmatic disconnect from
the remote client.  However, there _may_ have been network issues causing a
disconnect from the remote client.  

Stack trace:
java.lang.NullPointerException
        at
org.apache.commons.net.SocketClient.getRemoteAddress(SocketClient.java:502)
        at
com.hp.isee.perftest.harness.resources.TelnetKeepAlive.run(RemoteSystem.java:417)
        at java.util.TimerThread.mainLoop(Unknown Source)
        at java.util.TimerThread.run(Unknown Source)

Suggestion:
I think that a disconnected client should return a null value rather than throw
a NullPointerException.  I'd recommend changing line 502 of SocketClient.java from 

502         return _socket_.getInetAddress();

to 

502         if (_socket_ == null)
503             return null;
504         else
505              return _socket_.getInetAddress();

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org