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 bu...@apache.org on 2003/08/17 04:26:31 UTC

DO NOT REPLY [Bug 22487] New: - XSModelImpl.getComponentsByNamespace(Short, String): XSNamedMap has a comparison error

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22487>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22487

XSModelImpl.getComponentsByNamespace(Short, String): XSNamedMap has a comparison error

           Summary: XSModelImpl.getComponentsByNamespace(Short, String):
                    XSNamedMap has a comparison error
           Product: Xerces2-J
           Version: 2.5.0
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: DOM
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: granum@purdue.edu


* NOTE: The file version that I have was last updated as of v1.9. I downloaded 
the latest release package which unzipped as xerces-2_5_0 *

I won't swear I am right, but I am 99% certain. I get some funny errors when I 
call this function using a cast.. in fact, the only time the function works 
correctly is when I call it after creating a string from a literal string -- e.
g. 
String targetNamespace = "myTargetNamespace";
// works fine, if element exists, returns it
XSNamedMap map = getComponentsByNamespace(ELEMENT..., targetNamespace); 
// does NOT work
Vector vec = new Vector();
vec.add("myTargetNamespace");
map = getComponentsByNamespace(ELEMENT..., (String)vec.get(0));

Following is the code that (I think) is broken:
<Starting at line 305 of XSModelImpl 
// try to find the grammar
        int i = 0;
        for (; i < fGrammarCount; i++) {
            if (fNamespaces[i] == namespace) <-----!!!!!!!!!!! NO!!!!!
                break;
        }
        if (i == fGrammarCount)
            return null;
///////// End code snip
This is my version of the fix:
// try to find the grammar
        int i = 0;
        for (; i < fGrammarCount; i++) {
            if (fNamespaces[i].equals(namespace))
                break;
        }
        if (i == fGrammarCount)
            return null;
///////// End code snip


No, I don't really feel all that special. Took a while to figure out what was up 
though!

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