Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6337180

NamespaceContext.getNamespaceURI doesn't work as expected

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 1.0
    • xml
    • b92
    • generic
    • generic

      NamespaceContext object returned from XMLStreamReader won't work when a non-interned string is passed to the getNamespaceURI method.
      The following is the relevant code:
      --------------------------------------------
      com.sun.xml.stream.xerces.util.NamespaceContextWrapper

          public String getNamespaceURI(String prefix) {
              if(prefix == null){
                  throw new IllegalArgumentException("Prefix can't be null");
              }
              return fNamespaceContext.getURI(prefix) ;
          }
      --------------------------------------------
      com.sun.xml.stream.xerces.util.NamespaceSupport
          public String getURI(String prefix) {
              
              // find prefix in current context
              for (int i = fNamespaceSize; i > 0; i -= 2) {
                  if (fNamespace[i - 2] == prefix) {
                      return fNamespace[i - 1];
                  }
              }
              
              // prefix not found
              return null;
              
          } // getURI(String):String
      --------------------------------------------

      As you see the given parameter is compared with '=='.

            jsuttorsunw Jeff Suttor (Inactive)
            kkawagucsunw Kohsuke Kawaguchi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: