[ http://issues.apache.org/jira/browse/XERCESJ-1068?page=all ]
Michael Glavassevich updated XERCESJ-1068:
------------------------------------------
Fix Version: 2.8.0
Description:
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]))
was:
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]))
Environment:
> 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
> Fix For: 2.8.0
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]