You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@apache.org on 2001/01/29 13:23:05 UTC

cvs commit: xml-xalan/java/src/org/apache/xml/utils StringKey.java

sboag       01/01/29 04:23:04

  Modified:    java/src/org/apache/xml/utils StringKey.java
  Log:
  Provide toString method that returns the value of m_str.  In response
  to potential problem reported by Ito Kazumitsu <it...@hitachi-cable.co.jp>,
  01/28/2001 11:59 PM:
  
  I am afraid that the equals method defined in
  org/apache/xalan/xpath/xml/StringKey.java
  (Xalan-Java version 1.2.2) is not symmetric.
  
  String s = "aaaa";
  StringKey k = new StringKey(s);
  
  In this case, k.equals(s) is true, but s.equals(k) is
  false because k is not a String.  This is a violation of
  the symmetry expected of equivalence relations.
  
  If the use of this equals method is closed within Xalan,
  I do not care.  But it may be used in java.util.Hashtable.
  Although it seems Xalan's StringKey works fine with
  JDK's Hashtable now,  it may be only by chance and not
  necessarily so.
  
  In fact,  Xalan-Java cannot work with Kaffe Java VM because
  of the unsymmetric behaviour of equals of StringKey.
  
  Revision  Changes    Path
  1.3       +11 -0     xml-xalan/java/src/org/apache/xml/utils/StringKey.java
  
  Index: StringKey.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/StringKey.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringKey.java	2000/11/30 22:58:53	1.2
  +++ StringKey.java	2001/01/29 12:23:01	1.3
  @@ -105,4 +105,15 @@
     {
       return obj.equals(m_str);
     }
  +  
  +  /**
  +   * Return the value of the string key.
  +   * 
  +   * @return  a string representation of the object.
  +   */
  +  public String toString() 
  +  {
  +      return m_str;
  +  }
  +
   }