in core/src/main/java/org/apache/commons/jelly/tags/core/NewTag.java [53:99]
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
ArgTag parentArg = null;
if ( var == null ) {
parentArg = (ArgTag)(findAncestorWithClass(ArgTag.class));
if (null == parentArg) {
throw new MissingAttributeException( "var" );
}
}
if ( className == null ) {
throw new MissingAttributeException( "className" );
}
invokeBody(output);
try {
Class theClass = getClassLoader().loadClass( className );
Object object = null;
if (paramTypes.isEmpty()) {
object = theClass.getConstructor().newInstance();
} else {
Object[] values = paramValues.toArray();
Class[] types = (Class[]) (paramTypes.toArray(new Class[paramTypes.size()]));
object = ConstructorUtils.invokeConstructor(theClass, values, types);
paramTypes.clear();
paramValues.clear();
}
if (null != var) {
context.setVariable(var, object);
} else {
parentArg.setValue(object);
}
}
catch (ClassNotFoundException e) {
throw new JellyTagException(e);
}
catch (InstantiationException e) {
throw new JellyTagException(e);
}
catch (NoSuchMethodException e) {
throw new JellyTagException(e);
}
catch (IllegalAccessException e) {
throw new JellyTagException(e);
}
catch (InvocationTargetException e) {
throw new JellyTagException(e);
}
}