use of org.apache.tools.ant.input.InputHandler in project ant-ivy by apache.
the class AntCallTriggerTest method addInputHandler.
/**
* Creates the InputHandler and adds it to the project.
*
* @param project
* the project instance.
* @param inputHandlerClassname
* String
* @exception BuildException
* if a specified InputHandler implementation could not be loaded.
*/
private void addInputHandler(Project project, String inputHandlerClassname) throws BuildException {
InputHandler handler = null;
if (inputHandlerClassname == null) {
handler = new DefaultInputHandler();
} else {
try {
handler = (InputHandler) Class.forName(inputHandlerClassname).newInstance();
if (project != null) {
project.setProjectReference(handler);
}
} catch (ClassCastException e) {
String msg = "The specified input handler class " + inputHandlerClassname + " does not implement the InputHandler interface";
throw new BuildException(msg);
} catch (Exception e) {
String msg = "Unable to instantiate specified input handler " + "class " + inputHandlerClassname + " : " + e.getClass().getName();
throw new BuildException(msg);
}
}
project.setInputHandler(handler);
}
Aggregations