-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Eduard Papa opened SPR-7474 and commented
According to the javadoc for XMLStreamReader, when a null namespaceURI is passed to getAttributeValue(String, String), the method should return the attribute value without matching the namespace URI.
AbstractXmlStreamReader is not handling that condition correctly and tries to match the attribute's namespace with null:
if (name.getNamespaceURI().equals(namespaceURI) && name.getLocalPart().equals(localName)) {
return getAttributeValue( i ) ;
}
return null;
This results in getAttributeValue returning null whenever the namespaceURI parameter is null.
The fix would be to change the code above as follows:
if (*(namespaceURI == null || name.getNamespaceURI().equals(namespaceURI))* && name.getLocalPart().equals(localName)) {
return getAttributeValue( i ) ;
}
return null;
Please note that this problem exists in two classes:
org.springframework.util.xml.AbstractXmlStreamReader in Spring-Core 3.0.3
org.springframework.xml.stream.AbstractXmlStreamReader in Spring-Xml 1.5.9
Affects: 3.0.3
Attachments:
- XStreamMarshaller7474.java (1.75 kB)
Referenced from: commits 061b2c9