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

AttributeSet: attempt to compare Qname and String

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7, 8, 9
    • Fix Version/s: 12
    • Component/s: xml
    • Subcomponent:
    • Resolved In Build:
      b22
    • Verification:
      Not verified

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: