aalto-xml
aalto-xml copied to clipboard
`Attributes.getValue(String qName)` sometimes returns values from previous elements
I have an entity with no attributes. But getValue("SomeKey") is returning a value from a previous element.
I think the problem is that these lines
https://github.com/FasterXML/aalto-xml/blob/0820590fcf56ec3d5ca14608d6145e14e56f2650/src/main/java/com/fasterxml/aalto/sax/SAXParserImpl.java#L654-L666
Are missing the || index >= _attrCount that this has
https://github.com/FasterXML/aalto-xml/blob/0820590fcf56ec3d5ca14608d6145e14e56f2650/src/main/java/com/fasterxml/aalto/sax/SAXParserImpl.java#L647-L652
@nedtwigg Apologies for somehow missing this report. I don't know if it'd be possible, but I'd really like a reproduction (I assume "entity" in report means "element") to fix the problem.
I can try to build something on my end based on description and see how that goes; but may need help.
Ok, no. I do need a test case here to reproduce the problem. And I think the issue is with lookup, not bounds checks; some state is not being cleared, likely.
The thing I was using this for is still alive, but not currently under active development. I did a quick git log to look at the context from 2 years ago, and I can see the workaround in our codebase, but I can't quickly identify a reproducer testcase. I expect this project will become active again sometime in the next few months. When that happens, I'll provide the data here.
@nedtwigg understood. Thank you for all help you can give.