Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attributes.getValue(String qName) sometimes returns values from previous elements #80

Open
nedtwigg opened this issue Dec 22, 2022 · 4 comments

Comments

@nedtwigg
Copy link

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

@Override
public String getValue(String qName)
{
int ix = getIndex(qName);
return (ix < 0) ? null : _attrCollector.getValue(ix);
}
@Override
public String getValue(String uri, String localName)
{
int ix = getIndex(uri, localName);
return (ix < 0) ? null : _attrCollector.getValue(ix);
}

Are missing the || index >= _attrCount that this has

@Override
public String getValue(int index)
{
return (index < 0 || index >= _attrCount) ? null :
_attrCollector.getValue(index);
}

meiMingle added a commit to meiMingle/aalto-xml that referenced this issue Feb 3, 2023
@cowtowncoder
Copy link
Member

@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.

@cowtowncoder
Copy link
Member

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.

@nedtwigg
Copy link
Author

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.

@cowtowncoder
Copy link
Member

@nedtwigg understood. Thank you for all help you can give.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants