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

sjsxp issue 70 XmlStreamReaderImpl.getAttributeValue namespace arg. not interpreted properly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7
    • Fix Version/s: 1.4.0
    • Component/s: xml
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      h1141
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        Attribute namespace in XmlStreamReaderImpl.getAttributeValue is not interpreted
        according to JSR 173.

        Expected: Argument namespace "null" means: ignore namespace
        Actual: Attribute is found if and only if namespace is null (for unqualified
        attribute) or namespace matches exactly (for qualified attribute).

        Java default implementation has same bug. Test class my be provided or can be
        found in Java Bug Parade.

        SJSXP Issue 63
        This was a similar issue reported in issue 63:
        XMLStreamReader.getAttributeValue(uri, ln) fails if uri == ""
        Looks like implementation of XMLStreamReader.getAttributeValue(uri, localName)
        only works if namespace URI is passed as null, but not when passed as "".
        So, for example, following:

        XMLInputFactory f = XMLInputFactory.newInstance();
        XMLStreamReader sr = f.createXMLStreamReader(new StringReader("<root attr='1' />"));
                sr.next();
                String val1 = sr.getAttributeValue("", "attr");
                String val2 = sr.getAttributeValue(null, "attr");
                assertEquals(val1, val2)

        fails; val2 gets correct value ("1") whereas val1 gets null.
        This is incorrect: both should return "1".

        I noticed this problem when verifying operation of StaxMate when using sjsxp as
        the stax implementation: otherwise things work ok, but this is a significant
        problem (for time being, I can mostly work around it by explicitly converting ""
        to null for all calls)

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                joehw Joe Wang
                Reporter:
                joehw Joe Wang
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: