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

AttributeSet: attempt to compare Qname and String

XMLWordPrintable

    • b22
    • Not verified

      As found by errorprone:
      jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/AttributeSet.java

          public void parseContents(Parser parser) {

              // Get this attribute set's name
              final String name = getAttribute("name");

              if (!XML11Char.isXML11ValidQName(name)) {
                  ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name, this);
                  parser.reportError(Constants.ERROR, err);
              }
              _name = parser.getQNameIgnoreDefaultNs(name);
              if ((_name == null) || (_name.equals(EMPTYSTRING))) {

      _name is a QName, while name is a String. The author probably confused these two. (_name.equals(EMPTYSTRING)) is always false.

            joehw Joe Wang
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: