You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Paulex Yang (JIRA)" <ji...@apache.org> on 2006/08/15 09:07:15 UTC

[jira] Resolved: (HARMONY-1164) [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.

     [ http://issues.apache.org/jira/browse/HARMONY-1164?page=all ]

Paulex Yang resolved HARMONY-1164.
----------------------------------

    Resolution: Fixed

Andrew, patch partly applied at revision r431544, thanks a lot for this enhancement.  I left the regression tests, because it is multi-thread and depends on thread racing condition, i.e., it may be unstable if the ServerSocket.accept() cannot get CPU time, but of course, the bug report and fix itself is valid. If you got another stable regression test, please attach another patch and I will apply it. Please verify that the problem is fully fixed as you expected.


> [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
>         Assigned To: Paulex Yang
>         Attachments: Harmony-1164.diff
>
>
> 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