You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org> on 2006/02/27 05:53:21 UTC

[jira] Resolved: (XERCESJ-1068) XSNamedMap4Types.java: Doing Object comparison when Strings are compared

     [ http://issues.apache.org/jira/browse/XERCESJ-1068?page=all ]
     
Michael Glavassevich resolved XERCESJ-1068:
-------------------------------------------

    Resolution: Fixed

Nathan, I went with the alternative, doing both "==" and ".equals" checks instead of interning the namespace parameter.  I'm not convinced that there was a bug here but this does make the code a bit safer.

> XSNamedMap4Types.java: Doing Object comparison when Strings are compared
> ------------------------------------------------------------------------
>
>          Key: XERCESJ-1068
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1068
>      Project: Xerces2-J
>         Type: Bug
>   Components: XML Schema datatypes
>     Versions: 2.6.2
>     Reporter: Anil Saldhana
>     Assignee: Michael Glavassevich
>  Attachments: XSNamedMapImpl_patch.txt
>
> public XSObject itemByName(String namespace, String localName) {
>         if (namespace != null)
>             namespace = namespace.intern();
>         for (int i = 0; i < fNSNum; i++) {
>             if (namespace == fNamespaces[i]) {
>                 XSTypeDefinition type = (XSTypeDefinition)fMaps[i].get(localName);
>                 // only return it if it mataches the required type
>                 if (type.getTypeCategory() == fType)
>                     return type;
>                 return null;
>             }
>         }
>         return null;
>     }
> You are doing object comparison, when you should be doing the following:
> if(namespace.equals(fNamespaces[i]))

-- 
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


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