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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 7
    • xml
    • h1141
    • generic
    • generic
    • Verified

        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)

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

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: