diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2020-08-15 00:18:42 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2020-08-15 00:18:42 +0000 |
commit | 60303201dcb715a7738cd5bff3a85ffb424a2a90 (patch) | |
tree | 1154b264901ee5e32e7001175063d64b81f8b73f /src/excelant/java/org/apache | |
parent | e68bd7bd7ded6948a3289c6a6e3ad37453d12c42 (diff) | |
download | poi-60303201dcb715a7738cd5bff3a85ffb424a2a90.tar.gz poi-60303201dcb715a7738cd5bff3a85ffb424a2a90.zip |
use the forbidden-apis policies corresponding to the JRE
fix the forbidden apis issues
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1880866 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/excelant/java/org/apache')
-rw-r--r-- | src/excelant/java/org/apache/poi/ss/excelant/ExcelAntHandlerTask.java | 20 | ||||
-rw-r--r-- | src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtil.java | 5 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntHandlerTask.java b/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntHandlerTask.java index c6baee4f24..75892aa738 100644 --- a/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntHandlerTask.java +++ b/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntHandlerTask.java @@ -27,43 +27,43 @@ import org.apache.tools.ant.Task; * <p> * Its purpose is to provide a way to manipulate a workbook in the course * of an ExcelAnt task. The idea being to model a way for test writers to - * simulate the behaviors of the workbook. + * simulate the behaviors of the workbook. * <p> * Suppose, for example, you have a workbook that has a worksheet that * reacts to values entered or selected by the user. It's possible in * Excel to change other cells based on this but this isn't easily possible * in POI. In ExcelAnt we handle this using the Handler, which is a Java - * class you write to manipulate the workbook. + * class you write to manipulate the workbook. * <p> - * In order to use this tag you must write a class that implements the + * In order to use this tag you must write a class that implements the * <code>IExcelAntWorkbookHandler</code> interface. After writing the - * class you should package it and it's dependencies into a jar file to + * class you should package it and it's dependencies into a jar file to * add as library in your Ant build file. - * + * * @author Jon Svede ( jon [at] loquatic [dot] com ) * @author Brian Bush ( brian [dot] bush [at] nrel [dot] gov ) * */ public class ExcelAntHandlerTask extends Task { - + private String className ; - + private ExcelAntWorkbookUtil wbUtil ; public void setClassName( String cName ) { className = cName ; } - + protected void setEAWorkbookUtil( ExcelAntWorkbookUtil wkbkUtil ) { wbUtil = wkbkUtil ; } - + @Override public void execute() throws BuildException { log( "handling the workbook with class " + className, Project.MSG_INFO ) ; try { Class<?> clazz = Class.forName( className ) ; - Object handlerObj = clazz.newInstance() ; + Object handlerObj = clazz.getDeclaredConstructor().newInstance() ; if( handlerObj instanceof IExcelAntWorkbookHandler ) { IExcelAntWorkbookHandler iHandler = (IExcelAntWorkbookHandler)handlerObj ; iHandler.setWorkbook( wbUtil.getWorkbook() ) ; diff --git a/src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtil.java b/src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtil.java index 63cd97e523..ee3f443228 100644 --- a/src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtil.java +++ b/src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtil.java @@ -18,6 +18,7 @@ package org.apache.poi.ss.excelant.util; import java.io.FileInputStream; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -114,9 +115,9 @@ public class ExcelAntWorkbookUtil extends Typedef { * @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 { + public void addFunction(String name, String clazzName) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { Class<?> clazzInst = Class.forName(clazzName); - Object newInst = clazzInst.newInstance(); + Object newInst = clazzInst.getDeclaredConstructor().newInstance(); if(newInst instanceof FreeRefFunction) { addFunction(name, (FreeRefFunction)newInst); } |