You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2004/07/31 00:15:22 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/xni QName.java

mrglavas    2004/07/30 15:15:22

  Modified:    java/src/org/apache/xerces/xni QName.java
  Log:
  Fixing Jira Bug #997:
  http://nagoya.apache.org/jira/browse/XERCESJ-997
  
  Fixing an NPE which may occur in the hashCode method
  when either the localpart or rawname fields are null. This
  seems to only be a problem for external users of this class.
  
  Revision  Changes    Path
  1.7       +4 -3      xml-xerces/java/src/org/apache/xerces/xni/QName.java
  
  Index: QName.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xni/QName.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- QName.java	24 Feb 2004 23:15:54 -0000	1.6
  +++ QName.java	30 Jul 2004 22:15:22 -0000	1.7
  @@ -136,9 +136,10 @@
       /** Returns the hashcode for this object. */
       public int hashCode() {
           if (uri != null) {
  -            return uri.hashCode() + localpart.hashCode();
  +            return uri.hashCode() + 
  +                ((localpart != null) ? localpart.hashCode() : 0);
           }
  -        return rawname.hashCode();
  +        return (rawname != null) ? rawname.hashCode() : 0;
       } // hashCode():int
   
       /** Returns true if the two objects are equal. */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org