utsav00 opened a new pull request, #4278: URL: https://github.com/apache/solr/pull/4278
https://issues.apache.org/jira/browse/SOLR-18066 <!-- _(If you are a project committer then you may remove some/all of the following template.)_ * SOLR-18066: Fix hideIgnoreStackTrace from the solr.xml 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 Solr has a hideStackTrace setting in solr.xml that's meant to strip Java stack traces from HTTP error responses, The setting was being respected for core-level endpoints but completely ignored for coreless endpoints like `logging/levels` that aren't tied to any specific Solr index. # Solution The fix adds a two-tier fallback: 1. If there's a core -> read `hideStackTrace` from it (existing) 2. If there's no core -> fall back to the `CoreContainer` directly from the request context # Tests After building, fetch a coreless point - ```bash curl -s -X PUT http://localhost:8983/api/node/logging/levels \ -H "Content-Type: application/json" \ -d '{"logger": "org.apache.solr", "level": "DEBUG"}' | python3 -m json.tool ``` Same endpoint after toggling `hideStackTrace` in the solr.xml in the build folder The response after the fix and turning the respective config false - ```json { "responseHeader": { "status": 500, "QTime": 159 }, "error": { "code": 500, "errorClass": "com.fasterxml.jackson.databind.exc.MismatchedInputException", "msg": "Cannot deserialize value of type `java.util.ArrayList<org.apache.solr.client.api.model.LogLevelChange>` from Object value (token `JsonToken.START_OBJECT`)\n at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 1]" } } ``` No `trace` in the response body # Checklist Please review the following and check all that apply: - [x] 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. - [x] I have created a Jira issue and added the issue ID to my pull request title. - [x] 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) - [x] I have developed this patch against the `main` branch. - [x] I have run `./gradlew check`. - [x] I have added tests for my changes. - [x] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide) (nothing to do I believe) - [ ] I have added a [changelog entry](https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc) for my change -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
