Code Review 6921111: NullPointerException in PlainDatagramSocketImpl.socketSetOption (original) (raw)

Christopher Hegarty - Sun Microsystems Ireland Christopher.Hegarty at Sun.COM
Fri Mar 26 08:16:03 PDT 2010


On 03/26/10 13:45, Alan Bateman wrote:

Christopher Hegarty - Sun Microsystems Ireland wrote:

Hi Michael, Alan,

This is a very small change to fix a problem in native code where, if multiple threads are executing the native method, an unset value of a static variable may be used. When setting static variables in a block we can only be sure they are all set when the last one is. This is a common pattern in the socket impl native code. I plan to clean up this area of native code and remove unnecessary duplicate static state, but for now I just want to resolve this specific bug. Webrev: http://cr.openjdk.java.net/~chegar/6921111/webrev.00/webrev/ Thanks, -Chris. The proposed change will help but I assume it is not bullet proof. A slightly better fix might to be do the initialization if nisaddrsID or iaaddressID is NULL. I know I've mentioned this to you before, but I think it would be a lot better to just replace this code with a cleaner implementation in java.

Thanks Alan, you are of course correct I implemented your suggestion. For now I'll go ahead with what we have and create a new bug to rewrite this.

-Chris.

-Alan.



More information about the net-dev mailing list