* @throws IllegalArgumentException If catalog cannot be found
* @throws IllegalStateException If command property is not specified
*/
protected Command lookupExceptionCommand() {
String catalogName = getCatalogName();
Catalog catalog;
if (catalogName == null) {
catalog = CatalogFactory.getInstance().getCatalog();
if (catalog == null) {
LOG.error("Cannot find default catalog");
throw new IllegalArgumentException(
"Cannot find default catalog");
}
} else {
catalog = CatalogFactory.getInstance().getCatalog(catalogName);
if (catalog == null) {
LOG.error("Cannot find catalog '" + catalogName + "'");
throw new IllegalArgumentException("Cannot find catalog '"
+ catalogName + "'");
}
}
String exceptionCommand = getExceptionCommand();
if (exceptionCommand == null) {
LOG.error("No exceptionCommand property specified");
throw new IllegalStateException(
"No exceptionCommand property specfied");
}
return catalog.getCommand(exceptionCommand);
}