java.util.Hashtable: difference between JDK and kaffe

Ito Kazumitsu ito.kazumitsu at hitachi-cable.co.jp
Thu Jan 25 21:11:38 PST 2001


I found that Xalan XSLT processor (http://xml.apache.org/dist/xalan-j/
xalan-j_1_2_2.tar.gz) cannot work with kaffe.

And the cause of the problem seems to be in the different
behaviour of kaffe's java.util.Hashtable from that of JDK's.

The output of the attached program differs depending on
whether it is run on JDK or kaffe.

Program:

import java.util.Hashtable;
import org.apache.xalan.xpath.xml.StringKey;

public class Test
{
  static Hashtable hashtable = new Hashtable();

  public static void main(String[] args) {
      new Test();
  }

  public Test() {
      hashtable.put(new StringKey("TEST"), new Integer(9999));
      checkTable("TEST");
  }
 
  void checkTable(String key)
  {
    try
    {
      Object obj = hashtable.get(key);
      if (obj == null) {
         obj = hashtable.get(new StringKey(key));
         if (obj == null) {
            System.err.println(key+" not found");
         }
         else {
            System.err.println(key+" found using a StringKey key");
         }
      }
      else {
         System.err.println(key+" found using a String key");
      }
    }
    catch(Exception e)
    {
      System.err.println(e);
    }
  }
}
 
Results:

bash$ java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
bash$  CLASSPATH='.;/home/ito/xml/java/xalan/xalan-j_1_2_2/xerces.jar;/home/ito/xml/java/xalan/xalan-j_1_2_2/xalan.jar' java Test
TEST found using a String key

$ kaffe -version
Kaffe Virtual Machine
Copyright (c) 1996-2000
Transvirtual Technologies, Inc.  All rights reserved
Engine: Just-in-time v3   Version: 1.0.6   Java Version: 1.1
$ CLASSPATH=.:/home/ito/xml/xalan/xalan-j_1_2_2/xerces.jar:/home/ito/xml/xalan/xalan-j_1_2_2/xalan.jar kaffe Test
TEST found using a StringKey key


More information about the kaffe mailing list