/** * This routine will display the exception message if the option --terse is given. This routine * will get the root of the exception and display the message. It will then wrap it with * CommaneException and throw the exception to be handled by CLI framework. * * @param e * @throws CommandException */ public void displayExceptionMessage(Exception e) throws CommandException { // get the root cause of the exception Throwable rootException = ExceptionUtil.getRootCause(e); if (rootException.getLocalizedMessage() != null) CLILogger.getInstance().printDetailMessage(rootException.getLocalizedMessage()); throw new CommandException(getLocalizedString("CommandUnSuccessful", new Object[] {name}), e); }
/** * Executes the command * * @throws CommandException */ public void runCommand() throws CommandException, CommandValidationException { validateOptions(); String addon = null; try { addon = (String) operands.firstElement(); AddonControl ac = new AddonControl(); ac.uninstall(addon); } catch (Throwable t) { CLILogger.getInstance().printDetailMessage(t.getLocalizedMessage()); throw new CommandException(getLocalizedString("UninstallAddonFailed", new Object[] {addon})); } CLILogger.getInstance() .printDetailMessage(getLocalizedString("UninstallAddonCompleted", new Object[] {addon})); }