]> source.dussan.org Git - poi.git/commitdiff
excelant evaluator if seems useless
authorPJ Fanning <fanningpj@apache.org>
Thu, 30 Dec 2021 21:18:26 +0000 (21:18 +0000)
committerPJ Fanning <fanningpj@apache.org>
Thu, 30 Dec 2021 21:18:26 +0000 (21:18 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896546 13f79535-47bb-0310-9956-ffa450edef68

poi-excelant/src/main/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtil.java
poi/src/main/java/org/apache/poi/ss/format/CellNumberPartHandler.java

index 55d817794989c5a15aedb38a4977c0d58c21e961..2541b5174aa4fedeaf012ba6aca33d54eac9867f 100644 (file)
@@ -164,21 +164,22 @@ public class ExcelAntWorkbookUtil extends Typedef {
      */
     protected FormulaEvaluator getEvaluator(String fileName) {
         FormulaEvaluator evaluator;
-        if (fileName.endsWith(".xlsx")) {
-            if(xlsMacroList.size() > 0) {
+        if (!fileName.endsWith(".xlsx")) {
+            if(xlsMacroList.isEmpty()) {
+                evaluator = new XSSFFormulaEvaluator((XSSFWorkbook) workbook);
+            } else {
                 evaluator = XSSFFormulaEvaluator.create((XSSFWorkbook) workbook,
                                                          null,
                                                          getFunctions());
             }
-            evaluator = new XSSFFormulaEvaluator((XSSFWorkbook) workbook);
         } else {
-            if(xlsMacroList.size() > 0) {
+            if(xlsMacroList.isEmpty()) {
+                evaluator = new HSSFFormulaEvaluator((HSSFWorkbook) workbook);
+            } else {
                 evaluator = HSSFFormulaEvaluator.create((HSSFWorkbook)workbook,
                                                          null,
                                                          getFunctions());
             }
-
-            evaluator = new HSSFFormulaEvaluator((HSSFWorkbook) workbook);
         }
 
         return evaluator;
index a10aca3a281f28049f7f92196c0d41079cbdfb39..339203890eec1b97f644913d8473b1e50d1507ff 100644 (file)
@@ -81,7 +81,7 @@ public class CellNumberPartHandler implements PartHandler {
 
         case '/':
             //!! This assumes there is a numerator and a denominator, but these are actually optional
-            if (slash == null && specials.size() > 0) {
+            if (slash == null && !specials.isEmpty()) {
                 numerator = previousNumber();
                 // If the first number in the whole format is the numerator, the
                 // entire number should be printed as an improper fraction