mrglavas    2004/06/03 08:30:49

  Modified:    java/src/org/apache/xerces/impl/xs XSModelImpl.java
  Log:
  Fixing a bug reported to xerces-j-user by Robert Houben:

  http://marc.theaimsgroup.com/?l=xerces-j-user&m=108587697229050&w=2

  

  We were performing reference comparison with the namespace name

  passed into getComponentsByNamespace. The XML Schema API does not

  constrict users to using internalized strings so we must use equals.

  

  Should also be returning an empty map when a grammar does not exist

  for a given namespace instead of null.

  

  Both of these problems are now fixed.

  
  Revision  Changes    Path
  1.16      +13 -5     xml-xerces/java/src/org/apache/xerces/impl/xs/XSModelImpl.java
  
  Index: XSModelImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XSModelImpl.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- XSModelImpl.java  20 May 2004 03:39:45 -0000      1.15
  +++ XSModelImpl.java  3 Jun 2004 15:30:49 -0000       1.16
  @@ -283,12 +283,20 @@
           
           // try to find the grammar
           int i = 0;
  -        for (; i < fGrammarCount; i++) {
  -            if (fNamespaces[i] == namespace)
  -                break;
  +        if (namespace != null) {
  +            for (; i < fGrammarCount; ++i) {
  +                if (namespace.equals(fNamespaces[i]))
  +                    break;
  +            }
  +        }
  +        else {
  +            for (; i < fGrammarCount; ++i) {
  +                if (fNamespaces[i] == null)
  +                    break; 
  +            }
           }
           if (i == fGrammarCount)
  -            return null;
  +            return XSNamedMapImpl.EMPTY_MAP;
           
           // get the hashtable for this type of components
           if (fNSComponents[i][objectType] == null) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to