United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4818488 (so) Missing encoding conversion in handleSocketError
JDK-4818488 : (so) Missing encoding conversion in handleSocketError

Details
Type:
Bug
Submit Date:
2003-02-13
Status:
Resolved
Updated Date:
2006-06-21
Project Name:
JDK
Resolved Date:
2006-06-21
Component:
core-libs
OS:
solaris,solaris_10,windows_xp
Sub-Component:
java.nio
CPU:
x86,sparc,generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.1,1.4.2_08,5.0
Fixed Versions:

Related Reports
Backport:
Backport:

Sub Tasks

Description
It appears that an encoding conversion is missing when the function handleSocketError in src/solaris/native/sun/nio/ch/Net.c obtains a string from the C library function strerror and then passes it on to the JNI utility JNU_ThrowByNameWithLastError. C library functions use the native encoding of the current locale, e.g., EUC-JP for Japanese, while JNI functions generally expect Java-modified UTF-8.

                                    

Comments
EVALUATION

This should be fixed in Tiger.
###@###.### 2003-02-14
                                     
2003-02-14
EVALUATION

The fix is to set the "errorValue" back into "errno" then let
JNU_ThrowByNameWithLastError do the job.

A regression test is NOT included in the bugfix putback, because it's hard to
write a good one, which probably needs to figure out how to handle/play with
(1)a local version of OS (2)appropriately installed l10n message pacakges (3)set
the correct testing locale (4)run the java test case (5)the test case also need
to figure out how to verify an output text msessage is "correct" (not garbled),
meant you need to find an appropriate "golden data" based on the locale/os/version
to match the output...probably not worth the energy. A simple test case below
can help you manually verify the bug and its fix, for example on a Japanese Solaris
do something like 
(1)setenv LC_ALL ja
(2)java ExceptionMsg 2>& output
(3)verify the text in "output" via a browser, with encoding set to euc-jp.

public class ExceptionMsg {
    public static void main(String[] args) throws Throwable{
        try {
            SocketChannel socketChannel = SocketChannel.open();
            boolean b = socketChannel.connect(new InetSocketAddress("javaweb.sfbay", 4444));
        } catch (IOException e) {
	    System.out.println(e.getMessage());
        }
    }


}
                                     
2006-06-08



Hardware and Software, Engineered to Work Together