FYI: Win32 InetAddress fix (really)

Marco Trudel mtrudel@gmx.ch
Tue Oct 3 15:30:00 GMT 2006


Yep, this time it works :-)

thanks
Marco


Gary Benson wrote:
> Hi all,
> 
> Marco pointed out that my last commit didn't fix the
> NullPointerException.  This commit ought to.
> 
> Cheers,
> Gary
> 
> 
> ------------------------------------------------------------------------
> 
> Index: ChangeLog
> ===================================================================
> --- ChangeLog	(revision 117370)
> +++ ChangeLog	(working copy)
> @@ -1,3 +1,8 @@
> +2006-10-03  Gary Benson  <gbenson@redhat.com>
> +
> +	* java/net/InetAddress.java
> +	(<clinit>): Reorder the static initializers.
> +
>  2006-10-02  Gary Benson  <gbenson@redhat.com>
>  
>  	* java/net/InetAddress.java
> Index: java/net/InetAddress.java
> ===================================================================
> --- java/net/InetAddress.java	(revision 117370)
> +++ java/net/InetAddress.java	(working copy)
> @@ -66,6 +66,24 @@
>    private static final long serialVersionUID = 3286316764910316507L;
>  
>    /**
> +   * Stores static localhost address object.
> +   */
> +  static InetAddress LOCALHOST;
> +  static
> +  {
> +    try
> +      {
> +	LOCALHOST = getByAddress("localhost", new byte[] {127, 0, 0, 1});
> +	// Some soon-to-be-removed native code synchronizes on this.
> +	loopbackAddress = LOCALHOST;
> +      }
> +    catch (UnknownHostException e)
> +      {
> +	throw new RuntimeException("should never happen", e);
> +      }
> +  }    
> +
> +  /**
>     * Dummy InetAddress, used to bind socket to any (all) network interfaces.
>     */
>    static InetAddress ANY_IF;
> @@ -93,24 +111,6 @@
>    }
>    
>    /**
> -   * Stores static localhost address object.
> -   */
> -  static InetAddress LOCALHOST;
> -  static
> -  {
> -    try
> -      {
> -	LOCALHOST = getByAddress("localhost", new byte[] {127, 0, 0, 1});
> -	// Some soon-to-be-removed native code synchronizes on this.
> -	loopbackAddress = LOCALHOST;
> -      }
> -    catch (UnknownHostException e)
> -      {
> -	throw new RuntimeException("should never happen", e);
> -      }
> -  }    
> -
> -  /**
>     * The Serialized Form specifies that an int 'address' is saved/restored.
>     * This class uses a byte array internally so we'll just do the conversion
>     * at serialization time and leave the rest of the algorithm as is.



More information about the Java-patches mailing list