[
https://issues.apache.org/jira/browse/SOLR-18631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ivan Saric updated SOLR-18631:
------------------------------
Fix Version/s: main(11.0)
> SimpleOrderedMap.getImmutableCopy() returns a plain NamedList
> -------------------------------------------------------------
>
> Key: SOLR-18631
> URL: https://issues.apache.org/jira/browse/SOLR-18631
> Project: Solr
> Issue Type: Bug
> Components: SolrJ
> Reporter: Ivan Saric
> Priority: Minor
> Fix For: main(11.0)
>
>
> {{SimpleOrderedMap}} overrides {{clone()}} to return a {{SimpleOrderedMap}},
> but not {{getImmutableCopy()}}, which {{NamedList}} implements as {{new
> NamedList<>(Collections.unmodifiableList(copy.nvPairs))}}. So an immutable
> copy of a {{SimpleOrderedMap}} is a plain {{NamedList}}: the caller loses the
> {{Map}} view (SOLR-17623) and the single-key intent, and a later {{instanceof
> SimpleOrderedMap}} or cast fails.
> Found while auditing {{NamedList}} instantiations for SOLR-18612 (SIP-22 step
> 5); the two instantiations inside {{NamedList}} itself were left alone there
> because they must preserve the receiver's kind, and this is the
> {{SimpleOrderedMap}} half of that.
> Fix: override {{getImmutableCopy()}} in {{SimpleOrderedMap}} the way
> {{clone()}} is, returning a {{SimpleOrderedMap}} backed by an unmodifiable
> list, with a unit test asserting the type, immutability and contents of the
> copy.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]