Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-16219: ICUCollationField protected field IllegalAccessException from different classloader (#1028)

Michael Gibney223f8107608a
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index bc6cbc32201..bedbfecc4b9 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -159,6 +159,8 @@ Bug Fixes
* SOLR-16418: Introduce SolrResponseUtil to handle NPE during query timeout or exception when parsing SolrResponse (Kevin Risden)
+* SOLR-16219: ICUCollationField protected field IllegalAccessException from different classloader (Michael Gibney)
+
Other Changes
---------------------
* SOLR-16351: Upgrade Carrot2 to 4.4.3, upgrade randomizedtesting to 2.8.0. (Dawid Weiss)
diff --git a/solr/modules/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java b/solr/modules/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java
index 6a4a9a7620f..af15435b207 100644
--- a/solr/modules/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java
+++ b/solr/modules/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java
@@ -125,8 +125,8 @@ public class ICUCollationField extends FieldType {
@Override
protected void init(IndexSchema schema, Map<String, String> args) {
- failHardOnUdvas = schema.luceneVersion.onOrAfter(UDVAS_FORBIDDEN_AS_OF);
- if (on(trueProperties, USE_DOCVALUES_AS_STORED)) {
+ failHardOnUdvas = schema.getDefaultLuceneMatchVersion().onOrAfter(UDVAS_FORBIDDEN_AS_OF);
+ if ((trueProperties & USE_DOCVALUES_AS_STORED) != 0) {
// fail fast at fieldType init
warnOrFailUdvas(failHardOnUdvas);
}
diff --git a/solr/packaging/test/analysis_extras_config/conf/schema.xml b/solr/packaging/test/analysis_extras_config/conf/schema.xml
new file mode 100644
index 00000000000..51fbedba4c9
--- /dev/null
+++ b/solr/packaging/test/analysis_extras_config/conf/schema.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Test schema file for CollationField -->
+
+<schema name="test" version="1.0">
+
+ <fieldType name="string" class="solr.StrField" omitNorms="true" positionIncrementGap="0"/>
+
+ <!-- basic text field -->
+ <fieldType name="text" class="solr.TextField">
+ <analyzer>
+ <tokenizer class="solr.StandardTokenizerFactory"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <fieldType name="sort_ar_t" class="solr.ICUCollationField" locale="ar"/>
+ <fieldType name="sort_de_t" class="solr.ICUCollationField" locale="de" strength="primary"/>
+ <fieldType name="sort_tr_canon_t" class="solr.ICUCollationField" locale="tr" strength="primary"
+ decomposition="canonical"/>
+ <fieldType name="sort_da_t" class="solr.ICUCollationField" locale="da" strength="primary"/>
+
+ <field name="id" type="string" indexed="true" stored="true" multiValued="false" required="false"/>
+ <field name="_version_" type="string" indexed="true" docValues="true" stored="false" multiValued="false"/>
+ <field name="text" type="text" indexed="true" stored="false"/>
+ <field name="sort_ar" type="sort_ar_t" indexed="true" stored="false" multiValued="false"/>
+ <field name="sort_de" type="sort_de_t" indexed="true" stored="false" multiValued="false"/>
+ <field name="sort_tr_canon" type="sort_tr_canon_t" indexed="true" stored="false" multiValued="false"/>
+ <field name="sort_da" type="sort_da_t" indexed="true" stored="false" multiValued="false"/>
+
+
+ <uniqueKey>id</uniqueKey>
+
+ <!-- copy our text to some sort fields with different orders -->
+ <copyField source="text" dest="sort_ar"/>
+ <copyField source="text" dest="sort_de"/>
+ <copyField source="text" dest="sort_tr_canon"/>
+ <copyField source="text" dest="sort_da"/>
+</schema>
diff --git a/solr/packaging/test/analysis_extras_config/conf/solrconfig.xml b/solr/packaging/test/analysis_extras_config/conf/solrconfig.xml
new file mode 100644
index 00000000000..19de28ee1a6
--- /dev/null
+++ b/solr/packaging/test/analysis_extras_config/conf/solrconfig.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" ?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<config>
+ <luceneMatchVersion>${tests.luceneMatchVersion:LATEST}</luceneMatchVersion>
+ <indexConfig>
+ <useCompoundFile>${useCompoundFile:false}</useCompoundFile>
+ <lockType>single</lockType>
+ </indexConfig>
+ <requestHandler name="/select" class="solr.SearchHandler"></requestHandler>
+ <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
+</config>
diff --git a/solr/packaging/test/test_modules.bats b/solr/packaging/test/test_modules.bats
index c9bfaad9210..c261aef4dfe 100644
--- a/solr/packaging/test/test_modules.bats
+++ b/solr/packaging/test/test_modules.bats
@@ -38,3 +38,9 @@ teardown() {
assert_output --partial '"RESPONSE_TIME":'
refute_output --partial '"EXCEPTION"'
}
+
+@test "icu collation in analysis-extras module" {
+ run solr start -c -Dsolr.modules=analysis-extras
+ run solr create_collection -c COLL_NAME -d test/analysis_extras_config/conf
+ assert_output --partial "Created collection 'COLL_NAME'"
+}