You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "Kevin Risden (Jira)" <ji...@apache.org> on 2023/04/03 21:09:00 UTC

[jira] [Updated] (SOLR-16736) Replace commons-lang3 usages with Java

     [ https://issues.apache.org/jira/browse/SOLR-16736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Risden updated SOLR-16736:
--------------------------------
    Description: 
Done as separate commits:
* Remove `org.apache.commons.lang3.RandomStringUtils`
* Remove `StringUtils#join`
* Replace `StringUtils.leftPad`
* Replace `ArrayUtils#toPrimitive`
* Replace `StringUtils#repeat`
* Misc replacements (startsWith and isEmpty)
* Replace `StringUtils#split`
* Replace `ArrayUtils.toObject`
* Remove `org.apache.commons.lang3.SystemUtils`
* Remove `ArrayUtils.isEmpty` and `ArrayUtils.isNotEmpty`
* Replace `StringUtils#equals`
* Replace `StringUtils.isEmpty` and `StringUtils.isNotEmpty`
* Replace commons-lang3 builders (hashcode, equals)
* Remove `startsWith` / `endsWith`
* Replace `StringUtils.default*`
* Replace `NumberUtils.isCreatable`
* Replace `StringUtils.countMatches`
* Replace `ArrayUtils.add`
* Replace `StringUtils.contains`
* Migrate remaining usages to helper methods and forbid new usages of commons-lang3

This is NOT ready for review yet. This just works down the list of commons lang3 usages and tries to replace them with JDK methods where possible.

These are remaining:
* `LocaleUtils` - is there a good replacement? JDK Locale Builder does not work. Moved to LocaleUtils helper class
* `Object hostnameVerifier = FieldUtils.readField(sslSocketFactory, "hostnameVerifier", true);` - moved to standalone method
* `StringUtils.containsIgnoresCase` - This should be replaceable.
* `FastDateFormat` used in HDFS tests

{code:java}
# git grep -F org.apache.commons.lang3 -- solr
solr/core/src/java/org/apache/solr/request/SubstringBytesRefFilter.java:    return org.apache.commons.lang3.StringUtils.containsIgnoreCase(str, searchStr);
solr/core/src/java/org/apache/solr/util/LocaleUtils.java:    return org.apache.commons.lang3.LocaleUtils.toLocale(locale);
solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsTestUtil.java:      org.apache.commons.lang3.time.FastDateFormat.getInstance().format(System.currentTimeMillis());
solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpClientUtilTest.java:      return org.apache.commons.lang3.reflect.FieldUtils.readField(
{code}

  was:
Done as separate commits:
* Remove `org.apache.commons.lang3.RandomStringUtils`
* Remove `StringUtils#join`
* Replace `StringUtils.leftPad`
* Replace `ArrayUtils#toPrimitive`
* Replace `StringUtils#repeat`
* Misc replacements (startsWith and isEmpty)
* Replace `StringUtils#split`
* Replace `ArrayUtils.toObject`
* Remove `org.apache.commons.lang3.SystemUtils`
* Remove `ArrayUtils.isEmpty` and `ArrayUtils.isNotEmpty`
* Replace `StringUtils#equals`
* Replace `StringUtils.isEmpty` and `StringUtils.isNotEmpty`
* Replace commons-lang3 builders (hashcode, equals)
* Remove `startsWith` / `endsWith`
* Replace `StringUtils.default*`
* Replace `NumberUtils.isCreatable`
* Replace `StringUtils.countMatches`
* Replace `ArrayUtils.add`
* Replace `StringUtils.contains`
* Migrate remaining usages to helper methods and forbid new usages of commons-lang3

This is NOT ready for review yet. This just works down the list of commons lang3 usages and tries to replace them with JDK methods where possible.

These are remaining:
* `LocaleUtils` - is there a good replacement? JDK Locale Builder does not work. Moved to LocaleUtils helper class
* `Object hostnameVerifier = FieldUtils.readField(sslSocketFactory, "hostnameVerifier", true);` - moved to standalone method
* `StringUtils.containsIgnoresCase` - This should be replaceable.
* `FastDateFormat` used in HDFS tests

```
# git grep -F org.apache.commons.lang3 -- solr
solr/core/src/java/org/apache/solr/request/SubstringBytesRefFilter.java:    return org.apache.commons.lang3.StringUtils.containsIgnoreCase(str, searchStr);
solr/core/src/java/org/apache/solr/util/LocaleUtils.java:    return org.apache.commons.lang3.LocaleUtils.toLocale(locale);
solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsTestUtil.java:      org.apache.commons.lang3.time.FastDateFormat.getInstance().format(System.currentTimeMillis());
solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpClientUtilTest.java:      return org.apache.commons.lang3.reflect.FieldUtils.readField(
```


> Replace commons-lang3 usages with Java
> --------------------------------------
>
>                 Key: SOLR-16736
>                 URL: https://issues.apache.org/jira/browse/SOLR-16736
>             Project: Solr
>          Issue Type: Task
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Kevin Risden
>            Assignee: Kevin Risden
>            Priority: Minor
>
> Done as separate commits:
> * Remove `org.apache.commons.lang3.RandomStringUtils`
> * Remove `StringUtils#join`
> * Replace `StringUtils.leftPad`
> * Replace `ArrayUtils#toPrimitive`
> * Replace `StringUtils#repeat`
> * Misc replacements (startsWith and isEmpty)
> * Replace `StringUtils#split`
> * Replace `ArrayUtils.toObject`
> * Remove `org.apache.commons.lang3.SystemUtils`
> * Remove `ArrayUtils.isEmpty` and `ArrayUtils.isNotEmpty`
> * Replace `StringUtils#equals`
> * Replace `StringUtils.isEmpty` and `StringUtils.isNotEmpty`
> * Replace commons-lang3 builders (hashcode, equals)
> * Remove `startsWith` / `endsWith`
> * Replace `StringUtils.default*`
> * Replace `NumberUtils.isCreatable`
> * Replace `StringUtils.countMatches`
> * Replace `ArrayUtils.add`
> * Replace `StringUtils.contains`
> * Migrate remaining usages to helper methods and forbid new usages of commons-lang3
> This is NOT ready for review yet. This just works down the list of commons lang3 usages and tries to replace them with JDK methods where possible.
> These are remaining:
> * `LocaleUtils` - is there a good replacement? JDK Locale Builder does not work. Moved to LocaleUtils helper class
> * `Object hostnameVerifier = FieldUtils.readField(sslSocketFactory, "hostnameVerifier", true);` - moved to standalone method
> * `StringUtils.containsIgnoresCase` - This should be replaceable.
> * `FastDateFormat` used in HDFS tests
> {code:java}
> # git grep -F org.apache.commons.lang3 -- solr
> solr/core/src/java/org/apache/solr/request/SubstringBytesRefFilter.java:    return org.apache.commons.lang3.StringUtils.containsIgnoreCase(str, searchStr);
> solr/core/src/java/org/apache/solr/util/LocaleUtils.java:    return org.apache.commons.lang3.LocaleUtils.toLocale(locale);
> solr/modules/hdfs/src/test/org/apache/solr/hdfs/cloud/HdfsTestUtil.java:      org.apache.commons.lang3.time.FastDateFormat.getInstance().format(System.currentTimeMillis());
> solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpClientUtilTest.java:      return org.apache.commons.lang3.reflect.FieldUtils.readField(
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org