Harmony
  1. Harmony
  2. HARMONY-1117

[classlib][net] Harmony implementation of SocketImpl.getFileDescriptor() return real object, but RI return null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Harmony implementation of SocketImpl.getFileDescriptor() return real object, but RI return null

      Test---------------------------------------------------------------------------------------------------
      import java.io.*;
      import java.net.*;

      public class Test {
      public static void main(String[] args) {
      try

      { TestSocketImpl testSocketImpl = new TestSocketImpl(); System.out.println("res="+testSocketImpl.getFileDescriptor() ); }

      catch (Exception e)

      { e.printStackTrace(); }

      }

      }

      class TestSocketImpl extends SocketImpl {
      public FileDescriptor getFileDescriptor()

      { return super.getFileDescriptor(); }

      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; }

      }

      Output------------------------------------------------------------------------------------------------

      Harmony:
      java version 1.5 (subset)

      (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as app
      licable.
      res=java.io.FileDescriptor@6460646

      JRockit:
      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))

      res=null

      1. Harmony-1117.zip
        3 kB
        Andrew Zhang
      2. Harmony-1117.patch
        0.4 kB
        Igor V. Stolyarov

        Activity

        Hide
        Igor V. Stolyarov added a comment -

        Fix attached

        Show
        Igor V. Stolyarov added a comment - Fix attached
        Hide
        Andrew Zhang added a comment -

        Hi,

        Patch was updated. Similar problem also exists in DatagramSocketImpl. The patch moves the initialization code to subclass constructor. Regression tests are included in the patch too.

        To apply the patch, please:
        1. unzip the patch to luni module
        2. run patch.sh
        3. apply patch.diff

        Would you please have a try? Thanks!

        Best regards,
        Andrew

        Show
        Andrew Zhang added a comment - Hi, Patch was updated. Similar problem also exists in DatagramSocketImpl. The patch moves the initialization code to subclass constructor. Regression tests are included in the patch too. To apply the patch, please: 1. unzip the patch to luni module 2. run patch.sh 3. apply patch.diff Would you please have a try? Thanks! Best regards, Andrew
        Hide
        Paulex Yang added a comment -

        Andrew, patch applied at revision r447288, thanks a lot for this enhancement.

        Igor, please verify that the problem is fully fixed as you expected.

        Show
        Paulex Yang added a comment - Andrew, patch applied at revision r447288, thanks a lot for this enhancement. Igor, please verify that the problem is fully fixed as you expected.
        Hide
        Igor V. Stolyarov added a comment -

        Works for me.
        Thank you Paulex.

        Show
        Igor V. Stolyarov added a comment - Works for me. Thank you Paulex.
        Hide
        Paulex Yang added a comment -

        Verified by Igor.

        Show
        Paulex Yang added a comment - Verified by Igor.

          People

          • Assignee:
            Paulex Yang
            Reporter:
            Igor V. Stolyarov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development