Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 35835 invoked from network); 31 Jan 2006 14:42:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 31 Jan 2006 14:42:02 -0000 Received: (qmail 69587 invoked by uid 500); 31 Jan 2006 14:42:00 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 68887 invoked by uid 500); 31 Jan 2006 14:41:57 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 68876 invoked by uid 99); 31 Jan 2006 14:41:57 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jan 2006 06:41:55 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 283A5CB for ; Tue, 31 Jan 2006 15:41:34 +0100 (CET) Message-ID: <1259793835.1138718494162.JavaMail.jira@ajax.apache.org> Date: Tue, 31 Jan 2006 15:41:34 +0100 (CET) From: "Tim Ellison (JIRA)" To: harmony-dev@incubator.apache.org Subject: [jira] Assigned: (HARMONY-56) java.net.InetAddress.getAllByName(null) throws UnknownHostException instead of valid InetAddress In-Reply-To: <799434734.1138706552710.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/HARMONY-56?page=all ] Tim Ellison reassigned HARMONY-56: ---------------------------------- Assign To: Tim Ellison > java.net.InetAddress.getAllByName(null) throws UnknownHostException instead of valid InetAddress > ------------------------------------------------------------------------------------------------ > > Key: HARMONY-56 > URL: http://issues.apache.org/jira/browse/HARMONY-56 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Svetlana Samoilenko > Assignee: Tim Ellison > > According to j2se 1.4.2 specification java.net.InetAddress.getAllByName(String host) method allows a host is null. In this case the InetAddress representing an address of the loopback interface is returned. > But as we can see from the test listed below java.net.InetAddress.getAllByName(null) throws UnknownHostException instead of valid InetAddress. > Code to reproduce: > import java.net.*; > public class test2 { > public static void main (String[] args) { > > try { > InetAddress[] ia = InetAddress.getAllByName(null); > for (int i = 0; i System.out.println("***InetAddress.getAllByName(null)["+i+"] returned " + ia[i]); > } > } catch (Exception e) { > System.out.println("***Unexpected exception:" + e); > } > } > } > Steps to Reproduce: > 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. > 2. Compile test2.java using BEA 1.4 javac > > javac -d . test2.java > 3. Run java using compatible VM (J9) > > java -showversion test2 > Output: > C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 > java version "1.4.2_04" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) > BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel) > ***InetAddress.getAllByName(null)[0] returned localhost/127.0.0.1 > C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 > (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. > ***Unexpected exception:java.net.UnknownHostException: No host name provided > Suggested junit test case: > ------------------------ InetAddressTest.java ------------------------------------------------- > import java.net.*; > import junit.framework.*; > public class InetAddressTest extends TestCase { > public static void main(String[] args) { > junit.textui.TestRunner.run(InetAddressTest.class); > } > public void test_getAllByName() { > try { > InetAddress[] ia = InetAddress.getAllByName(null); > assertEquals ("Assert 0: getAllByName() returns incorrect value " + ia[0].toString(),"localhost/127.0.0.1",ia[0].toString()); > } catch (Exception e) { > fail("Assert 1: Unexpected exception:" + e); > } > } > } -- 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