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

InetAddress.getByName behaves differently on Windows

    Details

    • Subcomponent:
    • Resolved In Build:
      tiger
    • CPU:
      x86
    • OS:
      windows_2000, windows_2003
    • Verification:
      Verified

      Backports

        Description

        InetAddress.getByName("0") returns "0/0.0.0.0" as expected on Solaris and Linux. However on Windows, a java.net.UnknownHostException is thrown. I've tried Win2000 Pro, Win2003 SE, and WinXP Pro. All with the same result.

        Here's the test
        ---------------
        import java.net.InetAddress;

        public class test1 {
            public static void main(String argv[]){

                try {
                   System.out.println( InetAddress.getByName("0") );
                } catch(java.net.UnknownHostException e) {
                   e.printStackTrace();
                }

                return;
          
            }
        }

        Output from Windows
        -------------------
        java.net.UnknownHostException: 0: 0
                at java.net.InetAddress.getAllByName0(Unknown Source)
                at java.net.InetAddress.getAllByName0(Unknown Source)
                at java.net.InetAddress.getAllByName(Unknown Source)
                at java.net.InetAddress.getByName(Unknown Source)
                at test1.main(test1.java:7)

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jccollet Jean-Christophe Collet (Inactive)
                  Reporter:
                  jaleesunw James Lee (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: