Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-894

[classlib][net] java.net.DatagramSocket(null).getBroadcast() returns different values for harmony vs RI

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • Classlib
    • None

    Description

      The Harmony method DatagramSocket.getBroadcast() returns false while RI returns true.

      ================== test.java =====================
      import java.net.*;

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

      { System.out.println("getBroadcast()1 = " + new DatagramSocket().getBroadcast()); }

      catch (Exception e)

      { e.printStackTrace(); }
      try { System.out.println("getBroadcast()2 = " + new DatagramSocket((SocketAddress) null).getBroadcast()); } catch (Exception e) { e.printStackTrace(); }


      }
      }
      ==============================================

      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)

      getBroadcast()1 = true
      getBroadcast()2 = true

      C:\tmp\tmp17>C:\harmony\trunk_0427\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.
      getBroadcast()1 = true
      getBroadcast()2 = false

      Attachments

        1. 894.diff
          2 kB
          spark shen
        2. DatagramSocket.patch
          1 kB
          Vladimir Bossicard

        Activity

          People

            paulex Paulex Yang
            vladimir Vladimir Bossicard
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: