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
SOLR-16810: Under certain situations Solr produces managed schema XML with duplicate fields #1654
base: main
Are you sure you want to change the base?
Conversation
sb.append(g3); | ||
} else { | ||
sb.append(m.group(2)); | ||
sb.append(escapes[m.group(5).charAt(0)]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NULL_DEREFERENCE: object returned by m.group(5)
could be null and is dereferenced at line 247.
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Command | Usage |
---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
This PR had no visible activity in the past 60 days, labeling it as stale. Any new activity will remove the stale label. To attract more reviewers, please tag someone or notify the dev@solr.apache.org mailing list. Thank you for your contribution! |
Thank you StaleBot..... I just checked the JIRA and I was last to chime in, so I'll take this and try and get it over the finish line. |
This PR had no visible activity in the past 60 days, labeling it as stale. Any new activity will remove the stale label. To attract more reviewers, please tag someone or notify the dev@solr.apache.org mailing list. Thank you for your contribution! |
https://issues.apache.org/jira/browse/SOLR-16810
Description
While persisting the ManagedIndexSchema as XML, non-printable characters in field names get escaped as #nn;, where nn is the decimal representation of the non-printable character. For example, if the field name has the byte 0x14, it gets escaped as #20;. This in indistinguishable from the literal #20; in the field name. If we have two fields - one with the non-printable character and the other with the literal string, two fields get generated with the same name. Loading the resulting XML, naturally, causes an exception. To fix this, any occurrence of literal # in the field name should be escaped, with say ##.
A second problem is that while escaping happens when generating XML, the corresponding unescaping does not happen on loading it.
Solution
Both the suggested fixes are here. There are tests to expose the bugs and the fixes that pass the tests.
Tests
Added two sets of tests - one for IndexSchema.java and the other for XML.java
Checklist
Please review the following and check all that apply:
main
branch../gradlew check
.