try {
ctr.setAccessible(true);
return ctr.newInstance(initargs);
} catch (IllegalArgumentException e) {
String name = ctr.getName();
throw new ObjectCreationException("Exception thrown by constructor: " + name, e);
} catch (InstantiationException e) {
String name = ctr.getDeclaringClass().getName();
throw new AssertionError("Class is not instantiable [" + name + "]");
} catch (IllegalAccessException e) {
String name = ctr.getName();
throw new AssertionError("Constructor is not accessible [" + name + "]");
} catch (InvocationTargetException e) {
String name = ctr.getName();
throw new ObjectCreationException("Exception thrown by constructor: " + name, e);
}
}