Hi, While running Jetty 4.2.20 with kaffe (ChangeLog head : 2004-09-06 Dalibor Topic), I found a case where an unexpected NullPointerException is thrown. And I have found a possible bug in java.net.Socket.
Sun's API document says about java.net.Socket#getLocalAddress(): Returns: the local address to which the socket is bound or InetAddress.anyLocalAddress() if the socket is not bound yet. I am afraid InetAddress.anyLocalAddress() is not defined anywhere, but I suppose it means anylocal or wildcard address. So I fixed java/net/Socket.java and found Jetty worked without problem. --- libraries/javalib/java/net/Socket.java.orig Tue Jul 27 06:13:57 2004 +++ libraries/javalib/java/net/Socket.java Tue Sep 14 16:04:32 2004 @@ -479,7 +479,8 @@ /** * Returns the local address to which this socket is bound. If this socket - * is not connected, then <code>null</code> is returned. + * is not connected, then <code>InetAddress.anyLocalAddress()</code> is + * returned. * * @return The local address * @@ -487,22 +488,26 @@ */ public InetAddress getLocalAddress() { - if (! isBound()) - return null; - InetAddress addr = null; - try + if (! isBound()) { - addr = (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR); + addr = InetAddress.ANY_IF; } - catch (SocketException e) + else { - // (hopefully) shouldn't happen - // throw new java.lang.InternalError - // ("Error in PlainSocketImpl.getOption"); - return null; - } + try + { + addr = (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR); + } + catch (SocketException e) + { + // (hopefully) shouldn't happen + // throw new java.lang.InternalError + // ("Error in PlainSocketImpl.getOption"); + return null; + } + } // FIXME: According to libgcj, checkConnect() is supposed to be called // before performing this operation. Problems: 1) We don't have the _______________________________________________ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe