(Server) serverConstructor.newInstance(new Object[] {
rootElement, homeDir});
inst.init();
return inst;
} catch (ClassNotFoundException cnfe) {
throw new ServerInitializationException(MessageFormat
.format(INIT_SERVER_SEVERE_CLASSNOTFOUND,
new Object[] {className}));
} catch (IllegalAccessException iae) {
// improbable
throw new ServerInitializationException(MessageFormat
.format(INIT_SERVER_SEVERE_ILLEGALACCESS,
new Object[] {className}));
} catch (IllegalArgumentException iae) {
// improbable
throw new ServerInitializationException(MessageFormat
.format(INIT_SERVER_SEVERE_BADARGS,
new Object[] {className}));
} catch (InstantiationException ie) {
throw new ServerInitializationException(MessageFormat
.format(INIT_SERVER_SEVERE_MISSINGCONSTRUCTOR,
new Object[] {className}));
} catch (NoSuchMethodException nsme) {
throw new ServerInitializationException(MessageFormat
.format(INIT_SERVER_SEVERE_ISABSTRACT,
new Object[] {className}));
} catch (InvocationTargetException ite) {
// throw the constructor's thrown exception, if any
try {
throw ite.getCause(); // as of java 1.4
} catch (ServerInitializationException sie) {
throw sie;
} catch (ModuleInitializationException mie) {
throw mie;
} catch (Throwable t) {
// a runtime error..shouldn't happen, but if it does...
StringBuffer s = new StringBuffer();
s.append(t.getClass().getName());
s.append(": ");
for (int i = 0; i < t.getStackTrace().length; i++) {
s.append(t.getStackTrace()[i] + "\n");
}
throw new ServerInitializationException(s.toString());
}
}
} catch (FactoryConfigurationError fce) {
throw new ServerInitializationException(INIT_XMLPARSER_SEVERE_MISSING);
} catch (IllegalArgumentException iae) {
throw new ServerInitializationException(MessageFormat
.format(INIT_CONFIG_SEVERE_UNREADABLE, new Object[] {
configFile, iae.getMessage()}));
}
}