United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-5023633 : InetAddress never caches hostnames with upper case characters

Details
Type:
Bug
Submit Date:
2004-03-30
Status:
Resolved
Updated Date:
2005-01-19
Project Name:
JDK
Resolved Date:
2004-04-24
Component:
core-libs
OS:
solaris_8,windows_2000
Sub-Component:
java.net
CPU:
x86,sparc
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.2
Fixed Versions:
5.0 (b49)

Related Reports
Backport:

Sub Tasks

Description
Name: jl125535			Date: 03/30/2004


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

java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
Java HotSpot(TM) Server VM (build 1.5.0-beta-b32c, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
SunOS AS101 5.8 Generic_108528-23 sun4u sparc SUNW,Netra-T4


A DESCRIPTION OF THE PROBLEM :
JDK 1.4.2 and JDK 1.4.1_03 do not correctly cache hostnames with uppercase characters.    The following driver illustrates the problem.   Running snoop when running the program shows that it is doing a DNS lookup for every lookup for www.SUN.com but not for www.sun.com

Looks like this was broken in fixing Bug 4692867.

I decompiled the code for java.net.InetAddress in rt.jar and can see how it is converting to lower case when reading the cache but not when writing to it.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.  compile the attached java code.

2.  Start up snoop to DNS server

3.  Run program

/usr/local/java/1.4.2/bin/java -Dsun.net.inetaddr.ttl=600 DnsTest

4. Snoop output will show 50 lookups for www.SUN.com and one for www.sun.com


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
a single lookup for www.SUN.com

ACTUAL -
www.SUN.com lookup is never cached!

ERROR MESSAGES/STACK TRACES THAT OCCUR :
snoop output from test on my system:

# snoop 192.168.200.58
Using device /dev/eri (promiscuous mode)
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.SUN.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.SUN.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C www.sun.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R www.sun.com. Internet Addr 64.124.140.199
       AS101 -> maildns.loadtest.broadsoft.com DNS C 58.200.168.192.in-addr.arpa. Internet PTR ?
maildns.loadtest.broadsoft.com -> AS101        DNS R 58.200.168.192.in-addr.arpa. Internet PTR maildns.loadtest.broadsoft.com.
       AS101 -> maildns.loadtest.broadsoft.com DNS C maildns.loadtest.broadsoft.com. Internet Addr ?
maildns.loadtest.broadsoft.com -> AS101        DNS R maildns.loadtest.broadsoft.com. Internet Addr 192.168.200.58




REPRODUCIBILITY :
This bug can be reproduced always.

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

public class DnsTest {

  public static void main(String[] args) {

        try {

          System.out.println ("TTL" 
                              + System.getProperty("sun.net.inetaddr.ttl"));
          for (int i = 0 ; i < 50 ; i++ ) {
                InetAddress [] addrs = InetAddress.getAllByName ("www.SUN.com");
          }

          for (int j = 0 ; j < 50 ; j++ ) {
                InetAddress [] addrs = InetAddress.getAllByName ("www.sun.com");
          }


        } catch (Exception e) {
                System.out.println (e);
                e.printStackTrace ();
        }
  }
}

---------- END SOURCE ----------
(Incident Review ID: 240525) 
======================================================================

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger-beta2

FIXED IN:
tiger-beta2

INTEGRATED IN:
tiger-b49
tiger-beta2


                                     
2004-06-14
EVALUATION

Fix in progress.
                                     
2004-06-11



Hardware and Software, Engineered to Work Together