isaric commented on PR #4464:
URL: https://github.com/apache/solr/pull/4464#issuecomment-4671160534
`TestPackages.testCoreReloadingPlugin` is now fixed on this branch
(`11f40df6f5c`). Root cause was a chain of two related bugs:
1. **On main (introduced by part 1):** `SolrConfigHandler.handleGET` was
changed from `instanceof MapSerializable` to `instanceof MapWriter`. On
post-part-1 main, classes like `CacheConfig` still only implement
`MapSerializable`, so the check returns false and the code falls through to
`(Map<String, Object>) o` — `ClassCastException: CacheConfig cannot be cast to
Map`.
2. **On part 2:** My earlier fixup at `SolrConfigHandler:339, 372` used `new
SimpleOrderedMap<>(...)`, which does only shallow conversion.
`SolrConfig.writeMap` puts `(MapWriter) m -> {...}` lambdas as values for
`"query"`, `"updateHandler"`, etc. Those lambdas survive the SOM construction
unchanged, so downstream code casting to `Map` then blows up with
`SolrConfig$$Lambda cannot be cast to Map`.
Fix: use `Utils.convertToMap(..., new LinkedHashMap<>())` at both call sites
— it recursively materializes nested `MapWriter` / `IteratorWriter` values into
actual `Map` / `List` instances, matching the original `MapSerializable.toMap`
semantics that this code path was designed around.
Two of your earlier suggestions had to be walked back as part of this —
replies inline on those threads.
Verified passing on this branch:
- `TestPackages.testCoreReloadingPlugin`
- `TestSolrConfigHandler` (all 8 methods)
--
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]