Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6449565

Pre-1.4 SocketImpl no longer supported

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      beta
    • Introduced In Version:
      6
    • Resolved In Build:
      b95
    • CPU:
      x86
    • OS:
      linux

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.5.0_07"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
        Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)


        ADDITIONAL OS VERSION INFORMATION :
        Linux localhost.localdomain 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 i686 i386 GNU/Linux

        A DESCRIPTION OF THE PROBLEM :
        By trivial inspection Socket.checkOldImpl always sets oldImpl to false. For old SocketImpls, the method loop will exit when the SocketImpl class itself is inspected. The code should either stop before the SocketImpl class or check whether the derived-method is abstract or not.

        So, SocketImpl classes written for JREs prior to 1.4 (JSR-51) will not work. It appears that this bug was introduced by the fix for Bug 5089488. The bug is not present in the previous update, 1.5.0_06-b05.


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Try to connect an old-style socket.

        Compile the example below using the rt.jar from a 1.3 JRE.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The program should exit without printing anything.
        ACTUAL -
        Error message as below.

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        Exception in thread "main" java.lang.AbstractMethodError: java.net.SocketImpl.connect(Ljava/net/SocketAddress;I)V
                at java.net.Socket.connect(Socket.java:516)
                at java.net.Socket.connect(Socket.java:466)
                at java.net.Socket.<init>(Socket.java:366)
                at java.net.Socket.<init>(Socket.java:179)
                at OldSocketImpl.main(OldSocketImpl.java:11)


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.io.*;
        import java.net.*;

        class OldSocketImpl extends SocketImpl {
            public static void main(String[] args) throws Exception {
                Socket.setSocketImplFactory(new SocketImplFactory() {
                        public SocketImpl createSocketImpl() {
                            return new OldSocketImpl();
                        }
                });
                Socket socket = new Socket("localhost", 23);
            }
            public void setOption(int optID, Object value) throws SocketException { eh(); }
            public Object getOption(int optID) throws SocketException { throw eh(); }



            protected void create(boolean stream) throws IOException { /*eh();*/ }

            protected void connect(String host, int port) throws IOException { eh(); }

            protected void connect(InetAddress address, int port) throws IOException { /*eh();*/ }

        // Not in 1.3...
        // protected void connect(SocketAddress address, int timeout) throws IOException { eh(); }

            protected void bind(InetAddress host, int port) throws IOException { /*eh();*/ }
            protected void listen(int backlog) throws IOException { eh(); }

            protected void accept(SocketImpl s) throws IOException { eh(); }

            protected InputStream getInputStream() throws IOException { throw eh(); }

            protected OutputStream getOutputStream() throws IOException { throw eh(); }

            protected int available() throws IOException { throw eh(); }

            protected void close() throws IOException { /*eh();*/ }

            protected void sendUrgentData (int data) throws SocketException { eh(); }
            SocketException eh() throws SocketException { throw new SocketException("Eh?"); }
        }
        ---------- END SOURCE ----------

        Release Regression From : 5.0u6
        The above release value was the last known release where this
        bug was not reproducible. Since then there has been a regression.

        Release Regression From : 5.0u6
        The above release value was the last known release where this
        bug was not reproducible. Since then there has been a regression.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                chegar Chris Hegarty
                Reporter:
                gmanwanisunw Girish Manwani (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: