use of ExceptionUtil in excelant

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1907653 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2023-02-14 14:52:29 +00:00
parent 3968e289e4
commit f6cec39ba2
1 changed files with 7 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import java.util.Locale;
import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtil; import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtil;
import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtilFactory; import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtilFactory;
import org.apache.poi.util.ExceptionUtil;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
@ -104,6 +105,9 @@ public class ExcelAntTask extends Task {
try { try {
workbookUtil.addFunction(eaUdf.getFunctionAlias(), eaUdf.getClassName()); workbookUtil.addFunction(eaUdf.getFunctionAlias(), eaUdf.getClassName());
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new BuildException(e.getMessage(), e); throw new BuildException(e.getMessage(), e);
} }
} }
@ -144,6 +148,9 @@ public class ExcelAntTask extends Task {
Class.forName("org.apache.poi.hssf.usermodel.HSSFWorkbook"); Class.forName("org.apache.poi.hssf.usermodel.HSSFWorkbook");
Class.forName("org.apache.poi.ss.usermodel.WorkbookFactory"); Class.forName("org.apache.poi.ss.usermodel.WorkbookFactory");
} catch (Exception e) { } catch (Exception e) {
if (ExceptionUtil.isFatal(e)) {
ExceptionUtil.rethrow(e);
}
throw new BuildException( throw new BuildException(
"The <classpath> for <excelant> must include poi.jar and poi-ooxml.jar " + "The <classpath> for <excelant> must include poi.jar and poi-ooxml.jar " +
"if not in Ant's own classpath. Processing .xlsx spreadsheets requires " + "if not in Ant's own classpath. Processing .xlsx spreadsheets requires " +