Author: centic
Date: Sun Jun 10 18:55:33 2018
New Revision: 1833293
URL: http://svn.apache.org/viewvc?rev=1833293&view=rev
Log:
Fix some IDE warnings, Javadoc, useless asserts, ...
Modified:
poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtil.java
poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java
Modified:
poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtil.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtil.java?rev=1833293&r1=1833292&r2=1833293&view=diff
==============================================================================
---
poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtil.java
(original)
+++
poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtil.java
Sun Jun 10 18:55:33 2018
@@ -95,11 +95,8 @@ public class ExcelAntWorkbookUtil extend
}
try {
- FileInputStream fis = new FileInputStream(excelFileName);
- try {
- workbook = WorkbookFactory.create(fis);
- } finally {
- fis.close();
+ try (FileInputStream fis = new FileInputStream(excelFileName)) {
+ workbook = WorkbookFactory.create(fis);
}
} catch(Exception e) {
throw new BuildException("Cannot load file " + excelFileName
@@ -111,11 +108,11 @@ public class ExcelAntWorkbookUtil extend
/**
* Used to add a UDF to the evaluator.
- * @param name
- * @param clazzName
- * @throws ClassNotFoundException
- * @throws InstantiationException
- * @throws IllegalAccessException
+ * @param name The name of the function to add
+ * @param clazzName The class which implements this function
+ * @throws ClassNotFoundException if the class cannot be found
+ * @throws InstantiationException if the class cannot be constructed
+ * @throws IllegalAccessException if the constructor or the class is not
accessible
*/
public void addFunction(String name, String clazzName) throws
ClassNotFoundException, InstantiationException, IllegalAccessException {
Class<?> clazzInst = Class.forName(clazzName);
@@ -130,8 +127,8 @@ public class ExcelAntWorkbookUtil extend
* Updates the internal HashMap of functions with instance and alias passed
* in.
*
- * @param name
- * @param func
+ * @param name the name of the function to replace
+ * @param func the function to use
*/
protected void addFunction(String name, FreeRefFunction func) {
xlsMacroList.put(name, func);
@@ -140,7 +137,8 @@ public class ExcelAntWorkbookUtil extend
/**
* returns a UDFFinder that contains all of the functions added.
*
- * @return
+ * @return An instance of {@link UDFFinder} which can be used to
+ * lookup functions
*/
protected UDFFinder getFunctions() {
@@ -163,8 +161,9 @@ public class ExcelAntWorkbookUtil extend
* Returns a formula evaluator that is loaded with the functions that
* have been supplied.
*
- * @param fileName
- * @return
+ * @param fileName Specifies if XSSF or HSSF should be used for
+ * the evaluator
+ * @return A {@link FormulaEvaluator} constructed accordingly
*/
protected FormulaEvaluator getEvaluator(String fileName) {
FormulaEvaluator evaluator;
Modified:
poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java?rev=1833293&r1=1833292&r2=1833293&view=diff
==============================================================================
---
poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java
(original)
+++
poi/trunk/src/excelant/testcases/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java
Sun Jun 10 18:55:33 2018
@@ -22,7 +22,6 @@ import java.io.IOException;
import java.util.Date;
import java.util.List;
-import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.examples.formula.CalculateMortgageFunction;
import org.apache.poi.ss.excelant.BuildFileTest;
import org.apache.poi.ss.formula.udf.UDFFinder;
@@ -56,15 +55,14 @@ public class TestExcelAntWorkbookUtil ex
public void testLoadNotExistingFile() {
try {
- assertNotNull(new ExcelAntWorkbookUtilTestHelper(
-
"notexistingFile" ));
+ new ExcelAntWorkbookUtilTestHelper("notexistingFile");
fail("Should catch exception here");
} catch (BuildException e) {
assertTrue(e.getMessage().contains("notexistingFile"));
}
}
- public void testWorkbookConstructor() throws InvalidFormatException,
IOException {
+ public void testWorkbookConstructor() throws IOException {
File workbookFile = new File(mortgageCalculatorFileName);
FileInputStream fis = new FileInputStream(workbookFile);
Workbook workbook = WorkbookFactory.create(fis);
@@ -300,7 +298,6 @@ public class TestExcelAntWorkbookUtil ex
double value = fixture.getCellAsDouble(cell);
- assertNotNull(value);
assertEquals(0.0, value);
}
@@ -330,7 +327,6 @@ public class TestExcelAntWorkbookUtil ex
double value = fixture.getCellAsDouble(cell);
- assertNotNull(value);
assertEquals(DateUtil.getExcelDate(cellValue, false), value);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]