Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-1068

XSNamedMap4Types.java: Doing Object comparison when Strings are compared

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.6.2
    • 2.8.0
    • None

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

      Attachments

        1. XSNamedMapImpl_patch.txt
          1 kB
          Nathan Beyer

        Activity

          People

            mrglavas@ca.ibm.com Michael Glavassevich
            anil Anil Saldhana
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: