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

[jira] Created: (HARMONY-1235) [classlib][net] unexpected ClassCastException for ServerSocket.implAccept(Socket)

[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


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

        

[jira] Updated: (HARMONY-1235) [classlib][net] unexpected ClassCastException for ServerSocket.implAccept(Socket)

Posted by "Andrew Zhang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1235?page=all ]

Andrew Zhang updated HARMONY-1235:
----------------------------------

    Attachment: Harmony-1235-v2.diff

Hi Paulex,

You're right. Update patch fixes security problem. It also remove a never used variable "connectLock".

Any problem, please let me know. Thanks!

Best regards,
Andrew

> [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

        

[jira] Commented: (HARMONY-1235) [classlib][net] unexpected ClassCastException for ServerSocket.implAccept(Socket)

Posted by "Vladimir Ivanov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1235?page=comments#action_12430928 ] 
            
Vladimir Ivanov commented on HARMONY-1235:
------------------------------------------

verified, thanks

> [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

        

[jira] Commented: (HARMONY-1235) [classlib][net] unexpected ClassCastException for ServerSocket.implAccept(Socket)

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1235?page=comments#action_12429901 ] 
            
Paulex Yang commented on HARMONY-1235:
--------------------------------------

Andrew, seems reflection is hard to avoid in this case, but because the Class.getDeclaredField() and Field.setAccessible() methods are both needs security check, I think they may need to be wrapped into a PriviledgedAction. Any problem, please let me know, thank you.

> [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.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

        

[jira] Closed: (HARMONY-1235) [classlib][net] unexpected ClassCastException for ServerSocket.implAccept(Socket)

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1235?page=all ]

Paulex Yang closed HARMONY-1235.
--------------------------------


Verified by Vladimir

> [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

        

[jira] Assigned: (HARMONY-1235) [classlib][net] unexpected ClassCastException for ServerSocket.implAccept(Socket)

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1235?page=all ]

Paulex Yang reassigned HARMONY-1235:
------------------------------------

    Assignee: Paulex Yang

> [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.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

        

[jira] Resolved: (HARMONY-1235) [classlib][net] unexpected ClassCastException for ServerSocket.implAccept(Socket)

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ 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

        

[jira] Updated: (HARMONY-1235) [classlib][net] unexpected ClassCastException for ServerSocket.implAccept(Socket)

Posted by "Andrew Zhang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1235?page=all ]

Andrew Zhang updated HARMONY-1235:
----------------------------------

    Attachment: Harmony-1235.diff

Hi Vladimir,

Would you please check whether my patch solves the problem correctly? Thanks!

Best regards,
Andrew

> [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
>         Attachments: 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