}
public SyntaxDE createSyntaxDE(String dataType,String path,StringBuffer res,int minsize,int maxsize)
{
SyntaxDE ret=null;
ObjectFactory factory;
synchronized(this) {
factory=factories.get(dataType);
if (factory==null) {
factory=new ObjectFactory(Integer.parseInt(HBCIUtils.getParam("kernel.objpool.Syntax","1024")));
factories.put(dataType,factory);
}
}
ret=(SyntaxDE)factory.getFreeObject();
if (ret==null) {
// laden der klasse, die die syntax des de enthaelt
Class c;
try {
c=Class.forName("org.kapott.hbci.datatypes.Syntax"+dataType,false,this.getClass().getClassLoader());
} catch (ClassNotFoundException e) {
throw new NoSuchSyntaxException(dataType,path);
}
// holen des constructors fuer diese klasse
Constructor con;
try {
con=c.getConstructor(new Class[]{StringBuffer.class, int.class, int.class});
} catch (NoSuchMethodException e) {
throw new NoSuchConstructorException(dataType);
}
/* anlegen einer neuen instanz der syntaxklasse und initialisieren
mit dem uebergebenen wert */
try {
ret=(SyntaxDE)(con.newInstance(new Object[]{res, new Integer(minsize), new Integer(maxsize)}));
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
throw new ParseErrorException(HBCIUtilsInternal.getLocMsg("EXCMSG_PROT_ERRSYNDE",path),(Exception)e.getCause());
}
if (ret!=null) {
factory.addToUsedPool(ret);
}
} else {
try {
ret.init(res,minsize,maxsize);
factory.addToUsedPool(ret);
} catch (RuntimeException e) {
factory.addToFreePool(ret);
throw new ParseErrorException(HBCIUtilsInternal.getLocMsg("EXCMSG_PROT_ERRSYNDE",path),(Exception)e.getCause());
}
}
return ret;