harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-1164) [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.
Date Mon, 14 Aug 2006 07:10:13 GMT
[classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when
the proxy server replies malformed message.
------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-1164
                 URL: http://issues.apache.org/jira/browse/HARMONY-1164
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Andrew Zhang


java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server
replies malformed message. 
Following test reproduces the bug:
public void test_Socket() throws Exception {
        final ServerSocket ss = new ServerSocket(0);
        // Malformed proxy server thread
        new Thread() {
            public void run() {
                try {
                    ss.accept().close();
                } catch (IOException e) {
                    // ignore
                } finally {
                    try {
                        ss.close();
                    } catch (IOException e) {
                        // ignore
                    }
                }
            }

        }.start();
        SocketAddress addr = InetSocketAddress.createUnresolved("127.0.0.1", ss
                .getLocalPort());
        Proxy proxy = new Proxy(Proxy.Type.SOCKS, addr);
        Socket s = new Socket(proxy);
        SocketAddress destAddress = new InetSocketAddress("127.0.0.1", 2000);
        try {
            s.connect(destAddress);
            fail("should throw SocketException");
        } catch (SocketException e) {
            // expected
        }
    }
The test passes against RI while fails against Harmony.
I'll upload a patch to fix this problem soon. Thanks!

Best regards,
Andrew

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message