-
Bug
-
Resolution: Fixed
-
P3
-
7
-
h1141
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2185499 | 7 | Joe Wang | P3 | Closed | Fixed | m05 |
JDK-2182543 | 6u18 | Joe Wang | P3 | Resolved | Fixed | b02 |
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)
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)
- backported by
-
JDK-2182543 sjsxp issue 70 XmlStreamReaderImpl.getAttributeValue namespace arg. not interpreted properly
-
- Resolved
-
-
JDK-2185499 sjsxp issue 70 XmlStreamReaderImpl.getAttributeValue namespace arg. not interpreted properly
-
- Closed
-
- relates to
-
JDK-6949607 JAXP issue 63 : attribute is accessible with invalid namespace
-
- Resolved
-