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/23 08:51:15 UTC
[jira] Resolved: (HARMONY-1235) [classlib][net] unexpected
ClassCastException for ServerSocket.implAccept(Socket)
[ http://issues.apache.org/jira/browse/HARMONY-1235?page=all ]
Paulex Yang resolved HARMONY-1235.
----------------------------------
Resolution: Fixed
Andrew, patch applied at revision r433944 with minor changes, thanks a lot for this enhancement.
Vladimir, please verify that the problem is fully fixed as you expected.
> [classlib][net] unexpected ClassCastException for ServerSocket.implAccept(Socket)
> ---------------------------------------------------------------------------------
>
> Key: HARMONY-1235
> URL: http://issues.apache.org/jira/browse/HARMONY-1235
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Vladimir Ivanov
> Assigned To: Paulex Yang
> Attachments: Harmony-1235-v2.diff, Harmony-1235.diff
>
>
> The method ServerSocket().implAccept() throws unexpected ClassCastException on Harmony.
> ===================== test.java =======================
> import java.net.*;
> import java.io.*;
> public class test {
> public static void main (String[] args) throws Exception {
> new testServerSocket().myimplAccept(new testSocket(new TestSocketImpl()));
> }
> }
> class TestSocketImpl extends SocketImpl {
> protected void create(boolean arg0) throws IOException {}
> protected void connect(String arg0, int arg1) throws IOException {}
> protected void connect(InetAddress arg0, int arg1) throws IOException {}
> protected void connect(SocketAddress arg0, int arg1) throws IOException {}
> protected void bind(InetAddress arg0, int arg1) throws IOException {}
> protected void listen(int arg0) throws IOException {}
> protected void accept(SocketImpl arg0) throws IOException {}
> protected InputStream getInputStream() throws IOException {return null;}
> protected OutputStream getOutputStream() throws IOException {return null;}
> protected int available() throws IOException {return 0;}
> protected void close() throws IOException {}
> protected void sendUrgentData(int arg0) throws IOException {}
> public void setOption(int arg0, Object arg1) throws SocketException {}
> public Object getOption(int arg0) throws SocketException {return null;}
> }
> class testSocket extends Socket {
> public testSocket(SocketImpl impl) throws SocketException {
> super(impl);
> }
> }
> class testServerSocket extends ServerSocket {
> public testServerSocket() throws Exception {
> super();
> }
> public void myimplAccept(Socket s) throws Exception {
> super.implAccept(s);
> }
> }
> ===================================================
> Output:
> C:\tmp\tmp17>C:\jdk1.5.0_06\bin\java.exe -cp . -showversion test
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Exception in thread "main" java.net.SocketException: socket closed
> at java.net.PlainSocketImpl.socketAccept(Native Method)
> at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
> at java.net.ServerSocket.implAccept(ServerSocket.java:450)
> at testServerSocket.myimplAccept(test.java:37)
> at test.main(test.java:6)
> C:\tmp\tmp17>C:\jrockit-jdk1.5.0-windows-ia32\bin\java.exe -cp . -showversion test
> java version "1.5.0"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
> BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-win-ia32, R25.0.0-75, GC: System optimized over throughput (initial strategy singleparpar))
> java.net.SocketException: Connection aborted by peer
> at jrockit.net.SocketNativeIO.accept(ILjava.io.FileDescriptor;I)[B(Native Method)
> at jrockit.net.SocketNativeIO.accept(Ljava.io.FileDescriptor;Ljava.io.FileDescriptor;I)Ljrockit.net.InetAddressCache;(Unknown Source)
> at java.net.AbstractSocketImpl.accept(Ljava.net.SocketImpl;)V(Unknown Source)
> at java.net.ServerSocket.implAccept(ServerSocket.java:450)
> at testServerSocket.myimplAccept(test.java:37)
> at test.main(test.java:6)
> C:\tmp\tmp17>C:\harmony\classlib1.5\deploy\jdk\jre\bin\java.exe -cp . -showversion test
> java version 1.5 (subset)
> (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> Exception in thread "main" java.lang.ClassCastException: TestSocketImpl incompatible with org.apache.harmony.luni.net.PlainSocketImpl
> at org.apache.harmony.luni.net.PlainSocketImpl.accept(PlainSocketImpl.java:94)
> at java.net.ServerSocket.implAccept(ServerSocket.java:252)
> at testServerSocket.myimplAccept(test.java:37)
> at test.main(test.java:6)
--
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