aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-09-15 17:31:50 +0000
committerPJ Fanning <fanningpj@apache.org>2022-09-15 17:31:50 +0000
commit06e2213ac1e299bc5db3d4a6dc7009643764f15e (patch)
treecf7a8d9126208762b37b51b97ec83f99241a955d
parent47bcd74df9e403de4a2b6cd6207a305db62051ec (diff)
downloadpoi-06e2213ac1e299bc5db3d4a6dc7009643764f15e.tar.gz
poi-06e2213ac1e299bc5db3d4a6dc7009643764f15e.zip
lgtm issues
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1904092 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/atp/Switch.java2
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/functions/Baseifs.java2
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/functions/Roman.java2
3 files changed, 3 insertions, 3 deletions
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/atp/Switch.java b/poi/src/main/java/org/apache/poi/ss/formula/atp/Switch.java
index 1daad88b8c..b70eb4f748 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/atp/Switch.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/atp/Switch.java
@@ -56,7 +56,7 @@ public final class Switch implements FreeRefFunction {
return ErrorEval.NA;
}
- for (int i = 1; i < args.length; i = i+2) {
+ for (int i = 1; i < (args.length - 1); i += 2) {
try {
ValueEval value = OperandResolver.getSingleValue(args[i], ec.getRowIndex(), ec.getColumnIndex());
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Baseifs.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Baseifs.java
index e83ca3aef7..64ebc533be 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Baseifs.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Baseifs.java
@@ -67,7 +67,7 @@ import org.apache.poi.ss.formula.functions.Countif.ErrorMatcher;
// collect pairs of ranges and criteria
AreaEval[] ae = new AreaEval[(args.length - firstCriteria)/2];
I_MatchPredicate[] mp = new I_MatchPredicate[ae.length];
- for(int i = firstCriteria, k=0; i < args.length; i += 2, k++){
+ for(int i = firstCriteria, k=0; i < (args.length - 1); i += 2, k++){
ae[k] = convertRangeArg(args[i]);
mp[k] = Countif.createCriteriaPredicate(args[i+1], ec.getRowIndex(), ec.getColumnIndex());
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Roman.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Roman.java
index 4464ee4cff..299e48850f 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Roman.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Roman.java
@@ -148,7 +148,7 @@ public class Roman extends Fixed2ArgFunction {
continue;
}
String[] repl = REPLACEMENTS[i];
- for (int j=0; j<repl.length; j+=2) {
+ for (int j = 0; j < (repl.length - 1); j += 2) {
result = result.replace(repl[j],repl[j+1]);
}
}