This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push:
new e7c6c5b [LANG-1406] StringIndexOutOfBoundsException in
StringUtils.replaceIgnoreCase
e7c6c5b is described below
commit e7c6c5b66b8802be082dd1daf1e0e34c975ad49e
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Sep 11 09:57:28 2019 -0400
[LANG-1406] StringIndexOutOfBoundsException in
StringUtils.replaceIgnoreCase
Fix dead store issue found by SpotBugs and enforce SpotBugs on CI
builds.
---
.github/workflows/maven.yml | 2 +-
.travis.yml | 2 +-
src/main/java/org/apache/commons/lang3/StringUtils.java | 2 --
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 204e3a5..7574118 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -32,4 +32,4 @@ jobs:
with:
java-version: ${{ matrix.java }}
- name: Build with Maven
- run: mvn -V apache-rat:check javadoc:javadoc -Ddoclint=all package
--file pom.xml
+ run: mvn -V apache-rat:check spotbugs:check javadoc:javadoc
-Ddoclint=all package --file pom.xml
diff --git a/.travis.yml b/.travis.yml
index 09ef4cf..b651149 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,4 +32,4 @@ script:
- mvn
after_success:
- - mvn clean test jacoco:report coveralls:report -Ptravis-jacoco
javadoc:javadoc -Ddoclint=all
+ - mvn clean test spotbugs:check jacoco:report coveralls:report
-Ptravis-jacoco javadoc:javadoc -Ddoclint=all
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java
b/src/main/java/org/apache/commons/lang3/StringUtils.java
index a2402b1..7937547 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -6363,9 +6363,7 @@ public class StringUtils {
if (isEmpty(text) || isEmpty(searchString) || replacement == null ||
max == 0) {
return text;
}
- String searchText = text;
if (ignoreCase) {
- searchText = text.toLowerCase();
searchString = searchString.toLowerCase();
}
int start = 0;