You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "heythm (via GitHub)" <gi...@apache.org> on 2025/05/10 15:01:34 UTC
[PR] SOLR-17370 - Fix facet IllegalAccessException for string fields with numeric values [solr]
heythm opened a new pull request, #3346:
URL: https://github.com/apache/solr/pull/3346
https://issues.apache.org/jira/browse/SOLR-17370
<!--
_(If you are a project committer then you may remove some/all of the following template.)_
Before creating a pull request, please file an issue in the ASF Jira system for Solr:
* https://issues.apache.org/jira/projects/SOLR
For something minor (i.e. that wouldn't be worth putting in release notes), you can skip JIRA.
To create a Jira issue, you will need to create an account there first.
The title of the PR should reference the Jira issue number in the form:
* SOLR-####: <short description of problem or changes>
SOLR must be fully capitalized. A short description helps people scanning pull requests for items they can work on.
Properly referencing the issue in the title ensures that Jira is correctly updated with code review comments and commits. -->
# Description
This PR addresses a bug in Solr's facet serialization logic that could cause a java.lang.IllegalAccessException when faceting on string fields that contain numeric-looking values. The issue was observed when a field defined as type="string" in the schema (e.g. dv_device_code) was included in the facet field list, and some of its values were numeric. The serialization code would attempt to use Java reflection on internal Lucene classes (such as LongPoint), resulting in an access violation and a 500 error.
# Solution
- Added a defensive check in Utils.getReflectWriter to detect Lucene Point types (e.g org.apache.lucene.document.LongPoint) and avoid attempting reflective serialization on them.
- If such a type is encountered, Solr now falls back to a string representation (ClassName:toString()), preventing the IllegalAccessException and ensuring robust serialization.
- The fix is minimally invasive and only affects the serialization path for objects that would otherwise trigger the reflective access error.
# Tests
# Checklist
Please review the following and check all that apply:
- [ ] I have reviewed the guidelines for [How to Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my code conforms to the standards described there to the best of my ability.
- [ ] I have created a Jira issue and added the issue ID to my pull request title.
- [ ] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
- [ ] I have developed this patch against the `main` branch.
- [ ] I have run `./gradlew check`.
- [ ] I have added tests for my changes.
- [ ] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17370 - Fix facet IllegalAccessException for string fields with numeric values [solr]
Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #3346:
URL: https://github.com/apache/solr/pull/3346#discussion_r2099214277
##########
solr/solrj/src/java/org/apache/solr/common/util/Utils.java:
##########
@@ -909,6 +909,15 @@ public static void reflectWrite(MapWriter.EntryWriter ew, Object o) {
* @return a serializable version of the object
*/
public static Object getReflectWriter(Object o) {
+ // Defensive: Avoid reflective serialization for Lucene Point types (e.g., LongPoint)
+ // which are not meant to be serialized this way and can cause IllegalAccessException.
+ String lucenePointPkg = "org.apache.lucene.document.";
+ if (o != null
+ && o.getClass().getName().startsWith(lucenePointPkg)
Review Comment:
This feel like a hack to me. Perhaps it's the best choice but hard for me to say at this time before understanding how this is invoked. Maybe there's a solution preventing a Point field from getting here in the first place. A test would help!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17370 - Fix facet IllegalAccessException for string fields with numeric values [solr]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #3346:
URL: https://github.com/apache/solr/pull/3346#issuecomment-3094875663
This PR has had no activity for 60 days and is now labeled as stale. Any new activity will remove the stale label. To attract more reviewers, please tag people who might be familiar with the code area and/or notify the dev@solr.apache.org mailing list. To exempt this PR from being marked as stale, make it a draft PR or add the label "exempt-stale". If left unattended, this PR will be closed after another 60 days of inactivity. Thank you for your contribution!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] SOLR-17370 - Fix facet IllegalAccessException for string fields with numeric values [solr]
Posted by "heythm (via GitHub)" <gi...@apache.org>.
heythm closed pull request #3346: SOLR-17370 - Fix facet IllegalAccessException for string fields with numeric values
URL: https://github.com/apache/solr/pull/3346
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org