[PATCH] InetAddress windows fix

Alex Kasko mail at alexkasko.com
Fri Jan 17 12:24:57 PST 2014


On 01/17/2014 10:38 PM, Andrew wrote:
>
>
> ----- Original Message -----
>> Hi,
>>
>> ServerSocketChannel and some other network classes are broken in windows
>> 6b29 after d621c66dd504 changes [1]. Fields hostName, address and family
>> were removed from InetAddress class [2]. Access to these fields was
>> reimplemented through getters/setters in java.net module
>> (setInetAddress_addr(...) etc), but they are still referenced directly
>> from native code in windows networking implementation [3]
>> (Java_sun_nio_ch_ServerSocketChannelImpl_initIDs function). So Tomcat
>> won't start in Windows with "No such field error" thrown from native code.
>>
>> I exported getters and setters for address and family and use them in
>> sun.nio.ch too,
>> webrev -
>> http://cr.openjdk.java.net/~akasko/jdk6/webrev_inet_addr_windows.01/
>>
>> I am not fully comprehending mapfile-vers logic, maybe its changes are
>> not needed here.
>>
>> Results were tested running Tomcat in windows and linux.
>>
>>
>> [1] http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/d621c66dd504
>> [2]
>> http://hg.openjdk.java.net/jdk6/jdk6/jdk/diff/d621c66dd504/src/share/classes/java/net/InetAddress.java
>> [3]
>> http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/956e1047786a/src/windows/native/sun/nio/ch/ServerSocketChannelImpl.c
>>
>> --
>> Regards,
>> Alex Kasko
>>
>>
>
> I'm ok with the parts of this that mirror the UNIX changes.  What strikes me as odd is:
>
> -void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address) {
> +JNIEXPORT
> +void JNICALL setInetAddress_addr(JNIEnv *env, jobject iaObj, int address) {
>
> Why was this necessary?  The UNIX files use these functions without this change.
>

Symbols were not exported without these changes to calling conventions. 
I also noticed, that all other functions from net_util.h used in 
sun.nio.ch code are exported the same way (like NET_ThrowNew). I am not 
an expert here, just read a lot of MSDN and done some experiments. Maybe 
it is better to ifdef these changes.


-- 
Regards,
Alex Kasko

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3742 bytes
Desc: S/MIME Cryptographic Signature
Url : http://mail.openjdk.java.net/pipermail/jdk6-dev/attachments/20140118/5f66e76a/smime.p7s 


More information about the jdk6-dev mailing list