From: PJ Fanning Date: Tue, 1 Feb 2022 21:16:05 +0000 (+0000) Subject: sonar issues X-Git-Tag: REL_5_2_1~125 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c86141c9fd693edcb367388428ba1264214c2831;p=poi.git sonar issues git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897675 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java index 722d4334e4..8b3eef1bc4 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFFormulaEvaluator.java @@ -114,8 +114,7 @@ public abstract class BaseXSSFFormulaEvaluator extends BaseFormulaEvaluator { XSSFCell cell = row.getCell(cellIndex); String cellValue = cell.getRawValue(); String cellR = new CellReference(cell).formatAsString(false); - externalLinksTable.cacheData(sheet.getSheetName(), rowIndex + 1, cellR, cellValue); - + externalLinksTable.cacheData(sheet.getSheetName(), (long)rowIndex + 1, cellR, cellValue); } } diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/NumberValueFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/NumberValueFunction.java index bf87de22f0..b53b970736 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/NumberValueFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/NumberValueFunction.java @@ -76,7 +76,8 @@ public final class NumberValueFunction implements FreeRefFunction { return e.getErrorEval(); } - if("".equals(text)) text = "0"; //If an empty string ("") is specified as the Text argument, the result is 0. + if("".equals(text) || text == null) text = "0"; //If an empty string ("") is specified as the Text argument, the result is 0. + text = text.replace(" ", ""); //Empty spaces in the Text argument are ignored, even in the middle of the argument. For example, " 3 000 " is returned as 3000. String[] parts = text.split("["+decSep+"]"); String sigPart = "";