modifications to fix issue #2022.
These modifications also include a new ReturnCode definition:
QuickSetupCli return code and ApplicationExceptionType have been grouped into a new class: ApplicationErrorCode. Return code are now handled as emun.
In order to fix issue #2022, CANCELLED value is 0 (SUCCESSFUL).
1 files added
21 files modified
| | |
| | | |
| | | package org.opends.quicksetup; |
| | | |
| | | import static org.opends.quicksetup.ApplicationReturnCode.ReturnCode; |
| | | |
| | | /** |
| | | * This exception is used to encapsulate all the error that we might have |
| | | * during the installation. |
| | |
| | | |
| | | private String formattedMsg = null; |
| | | |
| | | private Type type; |
| | | |
| | | /** |
| | | * This enum contains the different type of ApplicationException that we can |
| | | * have. |
| | | * |
| | | */ |
| | | public enum Type |
| | | { |
| | | /** |
| | | * Error related to file system error: IOException writing files, permission |
| | | * errors, etc. |
| | | */ |
| | | FILE_SYSTEM_ERROR, |
| | | /** |
| | | * Error downloading jar files from web start server. This is specific |
| | | * to the web start installation. |
| | | */ |
| | | DOWNLOAD_ERROR, |
| | | /** |
| | | * Error during the configuration of the Directory Server. |
| | | */ |
| | | CONFIGURATION_ERROR, |
| | | /** |
| | | * Error during the import of data (base entry, from LDIF file or |
| | | * automatically generated data). |
| | | */ |
| | | IMPORT_ERROR, |
| | | /** |
| | | * Error starting the Open DS server. |
| | | */ |
| | | START_ERROR, |
| | | |
| | | /** |
| | | * Error stopping the Open DS server. |
| | | */ |
| | | STOP_ERROR, |
| | | |
| | | /** |
| | | * Error enabling the Windows service. |
| | | */ |
| | | WINDOWS_SERVICE_ERROR, |
| | | |
| | | /** |
| | | * Application specific error. |
| | | */ |
| | | APPLICATION, |
| | | |
| | | /** |
| | | * Error invoking an OpenDS tool. |
| | | */ |
| | | TOOL_ERROR, |
| | | |
| | | /** |
| | | * User canceled operation. |
| | | */ |
| | | CANCEL, |
| | | |
| | | /** |
| | | * A bug (for instance when we throw an IllegalStateException). |
| | | */ |
| | | BUG |
| | | } |
| | | private ReturnCode type; |
| | | |
| | | /** |
| | | * Creates a new ApplicationException of type FILE_SYSTEM_ERROR. |
| | |
| | | * @return ApplicationException with Type property being FILE_SYSTEM_ERROR |
| | | */ |
| | | public static ApplicationException createFileSystemException(String msg, |
| | | Exception e) { |
| | | return new ApplicationException(Type.FILE_SYSTEM_ERROR, msg, e); |
| | | Exception e) |
| | | { |
| | | return new ApplicationException(ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | msg, e); |
| | | } |
| | | |
| | | /** |
| | | * The constructor of the ApplicationException. |
| | | * @param type the type of error we have. |
| | | * @param localizedMsg a localized string describing the problem. |
| | | * @param rootCause the root cause of this exception. |
| | | * |
| | | * @param type |
| | | * the type of error we have. |
| | | * @param localizedMsg |
| | | * a localized string describing the problem. |
| | | * @param rootCause |
| | | * the root cause of this exception. |
| | | */ |
| | | public ApplicationException(Type type, String localizedMsg, |
| | | public ApplicationException(ReturnCode type, String localizedMsg, |
| | | Throwable rootCause) |
| | | { |
| | | super(localizedMsg, rootCause); |
| | |
| | | * @param formattedMsg a localized message with extra formatting |
| | | * @param rootCause the root cause of this exception. |
| | | */ |
| | | public ApplicationException(Type type, String localizedMsg, |
| | | public ApplicationException(ReturnCode type, String localizedMsg, |
| | | String formattedMsg, Throwable rootCause) |
| | | { |
| | | super(localizedMsg, rootCause); |
| | |
| | | * Returns the Type of this exception. |
| | | * @return the Type of this exception. |
| | | */ |
| | | public Type getType() |
| | | public ReturnCode getType() |
| | | { |
| | | return type; |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | | |
| | | /** |
| | | * This class defines enumeration of application return code. |
| | | */ |
| | | public final class ApplicationReturnCode |
| | | { |
| | | /** |
| | | * Enumeration defining return code. |
| | | */ |
| | | public enum ReturnCode |
| | | { |
| | | /** |
| | | * Return code: Application successful. |
| | | */ |
| | | SUCCESSFUL(0), |
| | | |
| | | /** |
| | | * Return code: User Cancelled uninstall. |
| | | */ |
| | | CANCELLED(0), |
| | | |
| | | /** |
| | | * Return code: User provided invalid data. |
| | | */ |
| | | USER_DATA_ERROR(2), |
| | | |
| | | /** |
| | | * Return code: Error accessing file system (reading/writing). |
| | | */ |
| | | FILE_SYSTEM_ACCESS_ERROR(3), |
| | | |
| | | /** |
| | | * Error downloading jar files from web start server. This is specific |
| | | * to the web start installation. |
| | | */ |
| | | DOWNLOAD_ERROR(4), |
| | | /** |
| | | * Error during the configuration of the Directory Server. |
| | | */ |
| | | CONFIGURATION_ERROR(5), |
| | | /** |
| | | * Error during the import of data (base entry, from LDIF file or |
| | | * automatically generated data). |
| | | */ |
| | | IMPORT_ERROR(6), |
| | | /** |
| | | * Error starting the Open DS server. |
| | | */ |
| | | START_ERROR(7), |
| | | |
| | | /** |
| | | * Error stopping the Open DS server. |
| | | */ |
| | | STOP_ERROR(8), |
| | | |
| | | /** |
| | | * Error enabling the Windows service. |
| | | */ |
| | | WINDOWS_SERVICE_ERROR(9), |
| | | |
| | | /** |
| | | * Application specific error. |
| | | */ |
| | | APPLICATION_ERROR(10), |
| | | |
| | | /** |
| | | * Error invoking an OpenDS tool. |
| | | */ |
| | | TOOL_ERROR(11), |
| | | |
| | | /** |
| | | * Return code: Bug. |
| | | */ |
| | | BUG(12), |
| | | /** |
| | | * Return code: Bug. |
| | | */ |
| | | PRINT_VERSION(50), |
| | | |
| | | /** |
| | | * Return code for errors that are non-specified. |
| | | */ |
| | | UNKNOWN(100); |
| | | |
| | | private int returnCode; |
| | | |
| | | /** |
| | | * Private constructor. |
| | | * |
| | | * @param returnCode |
| | | * the return code. |
| | | */ |
| | | private ReturnCode(int returnCode) |
| | | { |
| | | this.returnCode = returnCode; |
| | | } |
| | | |
| | | /** |
| | | * Returns the return code. |
| | | * |
| | | * @return the return code. |
| | | */ |
| | | public int getReturnCode() |
| | | { |
| | | return returnCode; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Private constructor. |
| | | */ |
| | | private ApplicationReturnCode() |
| | | { |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } catch (IOException e) { |
| | | throw new ApplicationException(ApplicationException.Type.START_ERROR, |
| | | getMsg("error-creating-build-info"), e); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.START_ERROR, |
| | | getMsg("error-creating-build-info"), e); |
| | | } finally { |
| | | if (is != null) { |
| | | try { |
| | |
| | | throws ApplicationException { |
| | | for (String prop : props) { |
| | | if (null == values.get(prop)) { |
| | | throw new ApplicationException(ApplicationException.Type.TOOL_ERROR, |
| | | getMsg("error-prop-value", prop), null); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.TOOL_ERROR, getMsg( |
| | | "error-prop-value", prop), null); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return 0 if everything worked fine, and an error code if something wrong |
| | | * occurred. |
| | | */ |
| | | protected int launchCli(CliApplication cliApp) { |
| | | protected int launchCli(CliApplication cliApp) |
| | | { |
| | | System.setProperty("org.opends.quicksetup.cli", "true"); |
| | | QuickSetupCli cli = new QuickSetupCli(cliApp, this); |
| | | int returnValue = cli.run(); |
| | | if (returnValue == QuickSetupCli.USER_DATA_ERROR) { |
| | | ApplicationReturnCode.ReturnCode returnValue = cli.run(); |
| | | if (returnValue.equals(ApplicationReturnCode.ReturnCode.USER_DATA_ERROR)) |
| | | { |
| | | printUsage(true); |
| | | System.exit(QuickSetupCli.USER_DATA_ERROR); |
| | | System.exit(ApplicationReturnCode.ReturnCode.USER_DATA_ERROR |
| | | .getReturnCode()); |
| | | } |
| | | return returnValue; |
| | | return returnValue.getReturnCode(); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (shouldPrintVersion()) |
| | | { |
| | | printVersion(); |
| | | System.exit(QuickSetupCli.PRINT_VERSION); |
| | | System.exit(ApplicationReturnCode.ReturnCode.PRINT_VERSION |
| | | .getReturnCode()); |
| | | } |
| | | else if (shouldPrintUsage()) { |
| | | printUsage(false); |
| | | System.exit(QuickSetupCli.SUCCESSFUL); |
| | | System.exit(ApplicationReturnCode.ReturnCode.SUCCESSFUL.getReturnCode()); |
| | | } else if (isCli()) { |
| | | CliApplication cliApp = createCliApplication(); |
| | | int exitCode = launchCli(cliApp); |
| | |
| | | import org.opends.quicksetup.util.ProgressMessageFormatter; |
| | | import org.opends.quicksetup.util.PlainTextProgressMessageFormatter; |
| | | import org.opends.quicksetup.util.Utils; |
| | | import org.opends.quicksetup.ApplicationReturnCode.ReturnCode; |
| | | import org.opends.quicksetup.event.ProgressUpdateListener; |
| | | import org.opends.quicksetup.event.ProgressUpdateEvent; |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | /** |
| | | * Controller for managing the execution of a CliApplication. |
| | | * This enum contains the different type of ApplicationException that we can |
| | | * have. |
| | | * |
| | | */ |
| | | public class QuickSetupCli { |
| | | |
| | | /** |
| | | * Return code: Application successful. |
| | | */ |
| | | static public int SUCCESSFUL = 0; |
| | | |
| | | /** |
| | | * Return code: User Cancelled uninstall. |
| | | */ |
| | | static public int CANCELLED = 1; |
| | | |
| | | /** |
| | | * Return code: User provided invalid data. |
| | | */ |
| | | static public int USER_DATA_ERROR = 2; |
| | | |
| | | /** |
| | | * Return code: Error accessing file system (reading/writing). |
| | | */ |
| | | static public int ERROR_ACCESSING_FILE_SYSTEM = 3; |
| | | |
| | | /** |
| | | * Return code: Error stopping server. |
| | | */ |
| | | static public int ERROR_STOPPING_SERVER = 4; |
| | | |
| | | /** |
| | | * Return code: Bug. |
| | | */ |
| | | static public int BUG = 5; |
| | | |
| | | /** |
| | | * Return code: Bug. |
| | | */ |
| | | static public int PRINT_VERSION = 50; |
| | | |
| | | /** |
| | | * Return code for errors that are non-specified. |
| | | */ |
| | | static public int UNKNOWN = 100; |
| | | |
| | | /** Arguments passed in the command line. */ |
| | | protected Launcher launcher; |
| | | |
| | |
| | | * @return the return code (SUCCESSFUL, CANCELLED, USER_DATA_ERROR, |
| | | * ERROR_ACCESSING_FILE_SYSTEM, ERROR_STOPPING_SERVER or BUG. |
| | | */ |
| | | public int run() |
| | | public ReturnCode run() |
| | | { |
| | | int returnValue; |
| | | ReturnCode returnValue; |
| | | // Parse the arguments |
| | | try |
| | | { |
| | |
| | | ApplicationException ue = cliApp.getRunError(); |
| | | if (ue != null) |
| | | { |
| | | ApplicationException.Type type = ue.getType(); |
| | | if (type != null) { |
| | | switch (type) |
| | | { |
| | | case FILE_SYSTEM_ERROR: |
| | | returnValue = ERROR_ACCESSING_FILE_SYSTEM; |
| | | break; |
| | | |
| | | case STOP_ERROR: |
| | | returnValue = ERROR_STOPPING_SERVER; |
| | | break; |
| | | |
| | | case BUG: |
| | | returnValue = BUG; |
| | | break; |
| | | |
| | | default: |
| | | returnValue = UNKNOWN; |
| | | break; |
| | | } |
| | | } else { |
| | | returnValue = UNKNOWN; |
| | | } |
| | | returnValue = ue.getType(); |
| | | } |
| | | else |
| | | { |
| | | returnValue = SUCCESSFUL; |
| | | returnValue = ApplicationReturnCode.ReturnCode.SUCCESSFUL; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // User cancelled installation. |
| | | returnValue = CANCELLED; |
| | | returnValue = ApplicationReturnCode.ReturnCode.CANCELLED; |
| | | } |
| | | } |
| | | catch (UserDataException uude) |
| | |
| | | System.err.println(StaticUtils.wrapText(uude.getLocalizedMessage(), |
| | | Utils.getCommandLineMaxLineWidth())); |
| | | System.err.println(); |
| | | returnValue = USER_DATA_ERROR; |
| | | returnValue = ReturnCode.USER_DATA_ERROR; |
| | | } |
| | | return returnValue; |
| | | } |
| | |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | String failedMsg = getThrowableMsg("error-creating-temp-file", null, ioe); |
| | | String failedMsg = getThrowableMsg("error-creating-temp-file", null, |
| | | ioe); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, failedMsg, ioe); |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | failedMsg, ioe); |
| | | } |
| | | } |
| | | |
| | |
| | | if (result != 0) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getMsg("error-configuring"), null); |
| | | } |
| | | } catch (Throwable t) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getThrowableMsg("error-configuring", null, t), t); |
| | | } |
| | | |
| | |
| | | catch (Throwable t) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getThrowableMsg("error-configuring-certificate", null, t), t); |
| | | } |
| | | } |
| | |
| | | if (result != 0) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getMsg("error-creating-base-entry"), null); |
| | | } |
| | | } catch (Throwable t) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getThrowableMsg("error-creating-base-entry", null, t), t); |
| | | } |
| | | |
| | |
| | | if (result != 0) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getMsg("error-importing-ldif"), null); |
| | | } |
| | | } catch (Throwable t) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getThrowableMsg("error-importing-ldif", null, t), t); |
| | | } |
| | | } |
| | |
| | | if (result != 0) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getMsg("error-import-ldif-tool-return-code", |
| | | Integer.toString(result)), null); |
| | | } |
| | | } catch (Throwable t) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getThrowableMsg("error-import-automatically-generated", |
| | | new String[] { Utils.listToString(argList, " "), |
| | | t.getLocalizedMessage()}, t), t); |
| | |
| | | { |
| | | String failedMsg = getThrowableMsg("error-connecting-to-local", null, ne); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, failedMsg, ne); |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, failedMsg, ne); |
| | | } |
| | | finally |
| | | { |
| | |
| | | setCurrentProgressStep(InstallProgressStep.CANCELING); |
| | | notifyListeners(null); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CANCEL, |
| | | ApplicationReturnCode.ReturnCode.CANCELLED, |
| | | getMsg("upgrade-canceled"), null); |
| | | } |
| | | } |
| | |
| | | { |
| | | } |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, failedMsg, t); |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, failedMsg, t); |
| | | } |
| | | |
| | | Set<SuffixDescriptor> suffixes = |
| | |
| | | { |
| | | String[] arg = {server.getHostPort(true)}; |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getMsg("cannot-connect-to-remote-generic", arg), ne); |
| | | } |
| | | finally |
| | |
| | | if (nTries == 1) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.APPLICATION, |
| | | ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, |
| | | pnfe.getLocalizedMessage(), null); |
| | | } |
| | | try |
| | |
| | | String failedMsg = getThrowableMsg("error-connecting-to-local", null, |
| | | t); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, failedMsg, t); |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | failedMsg, t); |
| | | } |
| | | createLocalAds(localCtx, false); |
| | | notifyListeners(getFormattedDone()); |
| | |
| | | if (nTries == 1) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.APPLICATION, |
| | | ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, |
| | | pnfe.getLocalizedMessage(), null); |
| | | } |
| | | try |
| | |
| | | { |
| | | String[] arg = {getHostDisplay(auth)}; |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getMsg("cannot-connect-to-remote-permissions", arg), x); |
| | | } |
| | | catch (NamingException ne) |
| | | { |
| | | String[] arg = {getHostDisplay(auth)}; |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getMsg("cannot-connect-to-remote-generic", arg), ne); |
| | | } |
| | | catch (TopologyCacheException tpe) |
| | |
| | | LOG.log(Level.WARNING, "Error reloading topology cache to "+ |
| | | "configure ADS replication.", tpe); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getMsg("bug-msg"), tpe); |
| | | } |
| | | catch (ADSContextException ace) |
| | | { |
| | | String[] args = {getHostDisplay(auth), ace.toString()}; |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getMsg("remote-ads-exception", args), ace); |
| | | } |
| | | finally |
| | |
| | | String failedMsg = getThrowableMsg("error-connecting-to-local", null, |
| | | t); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, failedMsg, t); |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | failedMsg, t); |
| | | } |
| | | createLocalAds(localCtx, true); |
| | | int replicationPort = |
| | |
| | | catch (ADSContextException ace) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getMsg("ads-exception", ace.toString()), ace); |
| | | } |
| | | finally |
| | |
| | | { |
| | | String failedMsg = getThrowableMsg("bug-msg", null, t); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, failedMsg, t); |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, failedMsg, t); |
| | | } |
| | | } |
| | | |
| | |
| | | String errorMessage = getMsg("cannot-connect-to-remote-generic", |
| | | server.getHostPort(true), ne.toString(true)); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, errorMessage, ne); |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, errorMessage, |
| | | ne); |
| | | } |
| | | return ctx; |
| | | } |
| | |
| | | { |
| | | LOG.log(Level.SEVERE, "Error creating task "+attrs, ne); |
| | | String[] arg = {sourceServerDisplay}; |
| | | throw new ApplicationException(ApplicationException.Type.APPLICATION, |
| | | getThrowableMsg("error-launching-initialization", arg, ne), ne); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, getThrowableMsg( |
| | | "error-launching-initialization", arg, ne), ne); |
| | | } |
| | | i++; |
| | | } |
| | |
| | | helper.isStoppedByError(state)) |
| | | { |
| | | ApplicationException ae = new ApplicationException( |
| | | ApplicationException.Type.APPLICATION, errorMsg, null); |
| | | ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, errorMsg, |
| | | null); |
| | | if ((lastLogMsg != null) && |
| | | helper.isPeersNotFoundError(lastLogMsg)) |
| | | { |
| | |
| | | catch (NamingException ne) |
| | | { |
| | | String[] arg = {sourceServerDisplay}; |
| | | throw new ApplicationException(ApplicationException.Type.APPLICATION, |
| | | getThrowableMsg("error-pooling-initialization", arg, ne), ne); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, getThrowableMsg( |
| | | "error-pooling-initialization", arg, ne), ne); |
| | | } |
| | | } |
| | | } |
| | |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | |
| | | import org.opends.quicksetup.ApplicationException; |
| | | import org.opends.quicksetup.ApplicationReturnCode; |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | | import org.opends.quicksetup.webstart.JnlpProperties; |
| | | import org.opends.quicksetup.util.Utils; |
| | |
| | | break; |
| | | default: |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.WINDOWS_SERVICE_ERROR, |
| | | ApplicationReturnCode.ReturnCode.WINDOWS_SERVICE_ERROR, |
| | | errorMessage, null); |
| | | } |
| | | } |
| | |
| | | int code = ConfigureWindowsService.disableService(System.out, System.err); |
| | | if (code == ConfigureWindowsService.SERVICE_DISABLE_ERROR) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.WINDOWS_SERVICE_ERROR, |
| | | ApplicationReturnCode.ReturnCode.WINDOWS_SERVICE_ERROR, |
| | | getMsg("error-disabling-windows-service"), null); |
| | | } |
| | | } |
| | |
| | | { |
| | | String failedMsg = getThrowableMsg("error-creating-temp-file", null, ioe); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, failedMsg, ioe); |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | failedMsg, ioe); |
| | | } |
| | | |
| | | try |
| | |
| | | writer.close(); |
| | | } catch (DirectoryException de) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getThrowableMsg("error-importing-ldif", null, de), de); |
| | | } catch (LDIFException le) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getThrowableMsg("error-importing-ldif", null, le), le); |
| | | } catch (IOException ioe) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, |
| | | getThrowableMsg("error-importing-ldif", null, ioe), ioe); |
| | | } catch (Throwable t) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.BUG, getThrowableMsg( |
| | | ApplicationReturnCode.ReturnCode.BUG, getThrowableMsg( |
| | | "bug-msg", t), t); |
| | | } |
| | | return ldifFile; |
| | |
| | | String errorMessage = getMsg("error-configuring-remote-generic", |
| | | serverDisplay, t.toString()); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, errorMessage, t); |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, errorMessage, |
| | | t); |
| | | } |
| | | } |
| | | |
| | |
| | | String errorMessage = getMsg("error-configuring-remote-generic", |
| | | serverDisplay, t.toString()); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CONFIGURATION_ERROR, errorMessage, t); |
| | | ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, errorMessage, |
| | | t); |
| | | } |
| | | } |
| | | |
| | |
| | | import java.security.KeyStoreException; |
| | | |
| | | import org.opends.quicksetup.ApplicationException; |
| | | import org.opends.quicksetup.ApplicationReturnCode; |
| | | import org.opends.quicksetup.ProgressStep; |
| | | import org.opends.quicksetup.Installation; |
| | | import org.opends.quicksetup.SecurityOptions; |
| | |
| | | |
| | | } catch (ApplicationException ex) |
| | | { |
| | | if (ApplicationException.Type.CANCEL.equals(ex.getType())) { |
| | | if (ApplicationReturnCode.ReturnCode.CANCELLED.equals(ex.getType())) { |
| | | uninstall(); |
| | | setCurrentProgressStep(InstallProgressStep.FINISHED_CANCELED); |
| | | notifyListeners(null); |
| | |
| | | updateSummaryWithServerState(hmSummary); |
| | | setCurrentProgressStep(InstallProgressStep.FINISHED_WITH_ERROR); |
| | | ApplicationException ex = new ApplicationException( |
| | | ApplicationException.Type.BUG, getThrowableMsg("bug-msg", t), t); |
| | | ApplicationReturnCode.ReturnCode.BUG, |
| | | getThrowableMsg("bug-msg", t), t); |
| | | String msg = getFormattedError(ex, true); |
| | | notifyListeners(msg); |
| | | LOG.log(Level.SEVERE, "Error installing.", t); |
| | |
| | | import java.util.logging.Logger; |
| | | |
| | | import org.opends.quicksetup.ApplicationException; |
| | | import org.opends.quicksetup.ApplicationReturnCode; |
| | | import org.opends.quicksetup.ProgressStep; |
| | | import org.opends.quicksetup.Installation; |
| | | import org.opends.quicksetup.webstart.JnlpProperties; |
| | |
| | | |
| | | } catch (ApplicationException ex) |
| | | { |
| | | if (ApplicationException.Type.CANCEL.equals(ex.getType())) { |
| | | if (ApplicationReturnCode.ReturnCode.CANCELLED.equals(ex.getType())) { |
| | | uninstall(); |
| | | setCurrentProgressStep(InstallProgressStep.FINISHED_CANCELED); |
| | | notifyListeners(null); |
| | |
| | | updateSummaryWithServerState(hmSummary); |
| | | setCurrentProgressStep(InstallProgressStep.FINISHED_WITH_ERROR); |
| | | ApplicationException ex = new ApplicationException( |
| | | ApplicationException.Type.BUG, getThrowableMsg("bug-msg", t), t); |
| | | ApplicationReturnCode.ReturnCode.BUG, |
| | | getThrowableMsg("bug-msg", t), t); |
| | | String msg = getFormattedError(ex, true); |
| | | notifyListeners(msg); |
| | | LOG.log(Level.SEVERE, "Error installing.", t); |
| | |
| | | |
| | | if (in == null) |
| | | { |
| | | throw new ApplicationException(ApplicationException.Type.DOWNLOAD_ERROR, |
| | | getMsg("error-zipinputstreamnull", new String[] {zipName}), null); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.DOWNLOAD_ERROR, getMsg( |
| | | "error-zipinputstreamnull", new String[] { zipName }), null); |
| | | } |
| | | |
| | | notifyListeners(getFormattedDone()); |
| | |
| | | if (!Utils.createDirectory(parent)) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | getMsg("error-could-not-create-parent-dir", |
| | | new String[] {parent}), null); |
| | | } |
| | |
| | | catch (IOException ioe) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | getMsg("error-could-not-create-parent-dir", new String[] {parent}), |
| | | ioe); |
| | | } |
| | |
| | | String msg = getMsg("error-starting-server-with-no-connection-handlers", |
| | | (t.getMessage() == null) ? t.toString() : t.getMessage()); |
| | | LOG.log(Level.INFO, msg, t); |
| | | throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR, |
| | | msg, t); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.IMPORT_ERROR, msg, t); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | catch (Throwable t) { |
| | | ue = new ApplicationException( |
| | | ApplicationException.Type.BUG, |
| | | ApplicationReturnCode.ReturnCode.BUG, |
| | | getThrowableMsg("bug-msg", t), t); |
| | | status = UninstallProgressStep.FINISHED_WITH_ERROR; |
| | | String msg = getFormattedError(ue, true); |
| | |
| | | errMsg = getMsg("error-deleting-directory", arg); |
| | | } |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, errMsg, null); |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | errMsg, null); |
| | | } |
| | | |
| | | notifyListeners(getFormattedDone() + getLineBreak()); |
| | |
| | | break; |
| | | default: |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.WINDOWS_SERVICE_ERROR, |
| | | ApplicationReturnCode.ReturnCode.WINDOWS_SERVICE_ERROR, |
| | | errorMessage, null); |
| | | } |
| | | } |
| | |
| | | Utils.getPath(buildFile), |
| | | installation.getInvalidityReason()); |
| | | error = new ApplicationException( |
| | | ApplicationException.Type.APPLICATION, |
| | | ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, |
| | | invalidMsg, null); |
| | | System.err.println(invalidMsg); |
| | | } |
| | |
| | | } catch (Throwable t) { |
| | | LOG.log(Level.INFO, "unexpected error extracting build", t); |
| | | String reason = t.getLocalizedMessage(); |
| | | error = new ApplicationException(ApplicationException.Type.APPLICATION, |
| | | getMsg("build-extractor-error", reason), t); |
| | | error = new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, getMsg( |
| | | "build-extractor-error", reason), t); |
| | | System.err.println(reason); |
| | | } finally { |
| | | finished = true; |
| | |
| | | package org.opends.quicksetup.upgrader; |
| | | |
| | | import org.opends.quicksetup.ApplicationException; |
| | | import org.opends.quicksetup.ApplicationReturnCode; |
| | | import org.opends.quicksetup.Installation; |
| | | import org.opends.quicksetup.UserInteraction; |
| | | import org.opends.quicksetup.Constants; |
| | |
| | | } catch (Exception e) { |
| | | String msg = getMsg("error-applying-custom-config"); |
| | | LOG.log(Level.INFO, msg, e); |
| | | throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR, |
| | | msg, e); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.IMPORT_ERROR, msg, e); |
| | | } |
| | | } |
| | | |
| | |
| | | } catch (Exception e) { |
| | | String msg = getMsg("error-applying-custom-schema"); |
| | | LOG.log(Level.INFO, msg, e); |
| | | throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR, |
| | | msg, e); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.IMPORT_ERROR, msg, e); |
| | | } |
| | | } |
| | | |
| | |
| | | } else if (retry.equals(r)) { |
| | | // do nothing; will retry; |
| | | } else { |
| | | throw new ApplicationException(ApplicationException.Type.CANCEL, |
| | | getMsg("upgrade-canceled"), e); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.CANCELLED, |
| | | getMsg("upgrade-canceled"), e); |
| | | } |
| | | } else { |
| | | throw e; |
| | |
| | | int ret = oo.getReturnCode(); |
| | | if (ret != 0) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.TOOL_ERROR, |
| | | ApplicationReturnCode.ReturnCode.TOOL_ERROR, |
| | | getMsg("error-ldif-diff-tool-return-code", |
| | | Integer.toString(ret)), |
| | | null); |
| | |
| | | |
| | | package org.opends.quicksetup.upgrader; |
| | | |
| | | import org.opends.quicksetup.ApplicationReturnCode; |
| | | import org.opends.quicksetup.CliApplication; |
| | | import org.opends.quicksetup.UserData; |
| | | import org.opends.quicksetup.UserDataException; |
| | |
| | | UserInteraction.MessageType.WARNING, |
| | | new String[] { cont, cancel }, |
| | | cont))) { |
| | | throw new ApplicationException(ApplicationException.Type.CANCEL, |
| | | getMsg("reversion-canceled"), null); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.CANCELLED, |
| | | getMsg("reversion-canceled"), null); |
| | | } |
| | | } |
| | | |
| | |
| | | } catch (Throwable e) { |
| | | if (!(e instanceof ApplicationException)) { |
| | | runError = new ApplicationException( |
| | | ApplicationException.Type.BUG, |
| | | ApplicationReturnCode.ReturnCode.BUG, |
| | | e.getLocalizedMessage(), e); |
| | | } else { |
| | | runError = (ApplicationException)e; |
| | |
| | | throw ae; |
| | | } catch (Exception e) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | getMsg("error-backup-filesystem"), |
| | | e); |
| | | } |
| | |
| | | |
| | | package org.opends.quicksetup.upgrader; |
| | | |
| | | import org.opends.quicksetup.ApplicationReturnCode; |
| | | import org.opends.quicksetup.BuildInformation; |
| | | import org.opends.quicksetup.UserInteraction; |
| | | import org.opends.quicksetup.ApplicationException; |
| | |
| | | directive.getMessage()); |
| | | } |
| | | } |
| | | throw new ApplicationException(ApplicationException.Type.APPLICATION, |
| | | getMsg("upgrade-oracle-unsupported", args), null); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, getMsg( |
| | | "upgrade-oracle-unsupported", args), null); |
| | | } else { |
| | | if (ui != null) { |
| | | for (VersionIssueNotifier.Directive directive : issues) { |
| | |
| | | new String[]{cont, cancel}, |
| | | defaultAction))) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.CANCEL, |
| | | ApplicationReturnCode.ReturnCode.CANCELLED, |
| | | getMsg("upgrade-canceled"), null); |
| | | } |
| | | } |
| | | } else { |
| | | throw new ApplicationException(ApplicationException.Type.APPLICATION, |
| | | getMsg("oracle-no-silent"), null); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, |
| | | getMsg("oracle-no-silent"), null); |
| | | } |
| | | } |
| | | } |
| | |
| | | import org.opends.quicksetup.CliApplication; |
| | | import static org.opends.quicksetup.Installation.*; |
| | | |
| | | import org.opends.quicksetup.ApplicationReturnCode; |
| | | import org.opends.quicksetup.WizardStep; |
| | | import org.opends.quicksetup.ProgressStep; |
| | | import org.opends.quicksetup.ApplicationException; |
| | |
| | | LOG.log(Level.INFO, |
| | | "Error starting server in order to apply custom" + |
| | | "schema and/or configuration", e); |
| | | throw new ApplicationException(ApplicationException.Type.APPLICATION, |
| | | getMsg("error-starting-server"), e); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, |
| | | getMsg("error-starting-server"), e); |
| | | } |
| | | |
| | | checkAbort(); |
| | |
| | | LOG.log(Level.INFO, "server stopped"); |
| | | } catch (Throwable t) { |
| | | LOG.log(Level.INFO, "Error stopping server", t); |
| | | throw new ApplicationException(ApplicationException.Type.BUG, |
| | | throw new ApplicationException(ApplicationReturnCode.ReturnCode.BUG, |
| | | getMsg("error-stopping-server"), t); |
| | | } |
| | | } |
| | |
| | | Utils.listToString(errors, |
| | | Constants.LINE_SEPARATOR, /*bullet=*/"\u2022 ", ""); |
| | | ApplicationException ae = new ApplicationException( |
| | | ApplicationException.Type.APPLICATION, |
| | | ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, |
| | | getMsg("error-upgraded-server-starts-with-errors", |
| | | Constants.LINE_SEPARATOR + formattedDetails), null); |
| | | UserInteraction ui = userInteraction(); |
| | |
| | | int port = getInstallation().getCurrentConfiguration().getPort(); |
| | | if (port != -1 && !Utils.canUseAsPort(port)) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.APPLICATION, |
| | | ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, |
| | | getMsg("error-port-in-use", Integer.toString(port)), |
| | | null); |
| | | } |
| | |
| | | } catch (IOException ioe) { |
| | | LOG.log(Level.INFO, "error determining if server running"); |
| | | this.runWarning = new ApplicationException( |
| | | ApplicationException.Type.TOOL_ERROR, |
| | | ApplicationReturnCode.ReturnCode.TOOL_ERROR, |
| | | getMsg("error-server-status"), ioe); |
| | | } |
| | | |
| | |
| | | |
| | | // We don't consider a user cancelation exception |
| | | // to be an error. |
| | | if (ae.getType() != ApplicationException.Type.CANCEL) { |
| | | if (ae.getType() != ApplicationReturnCode.ReturnCode.CANCELLED) { |
| | | this.runError = ae; |
| | | } else { |
| | | this.abort = true; |
| | |
| | | |
| | | } catch (Throwable t) { |
| | | this.runError = |
| | | new ApplicationException(ApplicationException.Type.BUG, |
| | | new ApplicationException(ApplicationReturnCode.ReturnCode.BUG, |
| | | getMsg("bug-msg"), t); |
| | | } finally { |
| | | try { |
| | |
| | | |
| | | private void checkAbort() throws ApplicationException { |
| | | if (abort) throw new ApplicationException( |
| | | ApplicationException.Type.CANCEL, |
| | | ApplicationReturnCode.ReturnCode.CANCELLED, |
| | | getMsg("upgrade-canceled"), null); |
| | | } |
| | | |
| | |
| | | throw ae; |
| | | } catch (Exception e) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | getMsg("error-backup-filesystem"), |
| | | e); |
| | | } |
| | |
| | | int ret = output.getReturnCode(); |
| | | if (ret != 0) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.TOOL_ERROR, |
| | | ApplicationReturnCode.ReturnCode.TOOL_ERROR, |
| | | getMsg("error-backup-db-tool-return-code", |
| | | Integer.toString(ret)), |
| | | null); |
| | |
| | | throw ae; |
| | | } catch (Exception e) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.TOOL_ERROR, |
| | | ApplicationReturnCode.ReturnCode.TOOL_ERROR, |
| | | getMsg("error-backup-db"), e); |
| | | } |
| | | } |
| | |
| | | throw ae; |
| | | } catch (Exception e) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | getMsg("error-initializing-upgrade"), e); |
| | | } |
| | | } |
| | |
| | | if (target.exists()) { |
| | | if (!target.delete()) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | getMsg("error-deleting-file", |
| | | Utils.getPath(target)), null); |
| | | } |
| | |
| | | } |
| | | if (!fileToRename.renameTo(target)) { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | getMsg("error-renaming-file", |
| | | Utils.getPath(fileToRename), |
| | | Utils.getPath(target)), null); |
| | |
| | | } catch (Exception e) { |
| | | String errMsg = getMsg("error-copying-file", args); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | errMsg, null); |
| | | } finally { |
| | | if (fis != null) { |
| | |
| | | } else { |
| | | String errMsg = getMsg("error-copying-file", args); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, errMsg, null); |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | errMsg, null); |
| | | } |
| | | } else { |
| | | LOG.log(Level.INFO, "Ignoring file '" + |
| | |
| | | errMsg = getMsg("error-deleting-directory", arg); |
| | | } |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, errMsg, null); |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | errMsg, null); |
| | | } |
| | | |
| | | if (application != null) { |
| | |
| | | // report the error to the user |
| | | StringBuilder error = op.getErrorMessage(); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.IMPORT_ERROR, |
| | | ApplicationReturnCode.ReturnCode.IMPORT_ERROR, |
| | | getMsg("error-apply-ldif-modify", dnByteString.toString(), |
| | | error != null ? error.toString() : ""), |
| | | null); |
| | |
| | | // report the error to the user |
| | | StringBuilder error = addOp.getErrorMessage(); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.IMPORT_ERROR, |
| | | ApplicationReturnCode.ReturnCode.IMPORT_ERROR, |
| | | getMsg("error-apply-ldif-add", dnByteString.toString(), |
| | | error != null ? error.toString() : ""), |
| | | null); |
| | |
| | | // report the error to the user |
| | | StringBuilder error = delOp.getErrorMessage(); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.IMPORT_ERROR, |
| | | ApplicationReturnCode.ReturnCode.IMPORT_ERROR, |
| | | getMsg("error-apply-ldif-delete", dnByteString.toString(), |
| | | error != null ? error.toString() : ""), |
| | | null); |
| | |
| | | break; |
| | | default: |
| | | LOG.log(Level.SEVERE, "Unexpected record type " + cre.getClass()); |
| | | throw new ApplicationException(ApplicationException.Type.BUG, |
| | | throw new ApplicationException(ApplicationReturnCode.ReturnCode.BUG, |
| | | getMsg("bug-msg"), |
| | | null); |
| | | } |
| | |
| | | * The return code is not the one expected, assume the server could |
| | | * not be stopped. |
| | | */ |
| | | throw new ApplicationException(ApplicationException.Type.STOP_ERROR, |
| | | ResourceProvider.getInstance().getMsg( |
| | | "error-stopping-server-code", |
| | | String.valueOf(returnValue)), |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.STOP_ERROR, ResourceProvider |
| | | .getInstance().getMsg("error-stopping-server-code", |
| | | String.valueOf(returnValue)), |
| | | null); |
| | | } else { |
| | | if (application != null) { |
| | |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | throw new ApplicationException(ApplicationException.Type.STOP_ERROR, |
| | | getThrowableMsg("error-stopping-server", e), e); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.STOP_ERROR, getThrowableMsg( |
| | | "error-stopping-server", e), e); |
| | | } |
| | | } finally { |
| | | if (suppressOutput && StandardOutputSuppressor.isSuppressed()) { |
| | |
| | | if (Utils.isWindows()) |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.START_ERROR, |
| | | ApplicationReturnCode.ReturnCode.START_ERROR, |
| | | getMsg("error-starting-server-in-windows", |
| | | String.valueOf(port)), |
| | | null); |
| | |
| | | else |
| | | { |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.START_ERROR, |
| | | ApplicationReturnCode.ReturnCode.START_ERROR, |
| | | getMsg("error-starting-server-in-unix", |
| | | String.valueOf(port)), |
| | | null); |
| | |
| | | |
| | | } catch (IOException ioe) |
| | | { |
| | | throw new ApplicationException(ApplicationException.Type.START_ERROR, |
| | | getThrowableMsg("error-starting-server", ioe), |
| | | ioe); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.START_ERROR, getThrowableMsg( |
| | | "error-starting-server", ioe), ioe); |
| | | } |
| | | } finally { |
| | | if (suppressOuput && StandardOutputSuppressor.isSuppressed()) { |
| | |
| | | } |
| | | } catch (Throwable t) |
| | | { |
| | | ex = |
| | | new ApplicationException(ApplicationException.Type.START_ERROR, |
| | | getThrowableMsg(errorTag, t), t); |
| | | ex = new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.START_ERROR, |
| | | getThrowableMsg(errorTag, t), t); |
| | | |
| | | } |
| | | isFinished = true; |
| | |
| | | |
| | | package org.opends.quicksetup.util; |
| | | |
| | | import org.opends.quicksetup.ApplicationReturnCode; |
| | | import org.opends.quicksetup.Installation; |
| | | import org.opends.quicksetup.ApplicationException; |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | |
| | | if (e instanceof ApplicationException) { |
| | | throw (ApplicationException)e; |
| | | } else { |
| | | throw new ApplicationException(ApplicationException.Type.APPLICATION, |
| | | ResourceProvider.getInstance().getMsg( |
| | | "error-server-health-check-failure"), e); |
| | | throw new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, ResourceProvider |
| | | .getInstance().getMsg("error-server-health-check-failure"), e); |
| | | } |
| | | } finally { |
| | | if (control != null) { |
| | |
| | | |
| | | import org.opends.quicksetup.ApplicationException; |
| | | import org.opends.quicksetup.Application; |
| | | import org.opends.quicksetup.ApplicationReturnCode; |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | | |
| | | import java.io.*; |
| | |
| | | "error-copying", arg, ioe); |
| | | |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | errorMsg, ioe); |
| | | } |
| | | } |
| | |
| | | Utils.getThrowableMsg(ResourceProvider.getInstance(), |
| | | "error-zip-stream", arg, ioe); |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, errorMsg, ioe); |
| | | ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | errorMsg, ioe); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | | import org.opends.quicksetup.ApplicationException; |
| | | import org.opends.quicksetup.ApplicationReturnCode; |
| | | import org.opends.quicksetup.util.Utils; |
| | | |
| | | /** |
| | |
| | | { |
| | | // This is a bug |
| | | ex = |
| | | new ApplicationException(ApplicationException.Type.BUG, |
| | | new ApplicationException(ApplicationReturnCode.ReturnCode.BUG, |
| | | getExceptionMsg( |
| | | "bug-msg", mfe), mfe); |
| | | } catch (IOException ioe) |
| | |
| | | String[] arg = |
| | | { buf.toString() }; |
| | | ex = |
| | | new ApplicationException(ApplicationException.Type.DOWNLOAD_ERROR, |
| | | getExceptionMsg("downloading-error", arg, ioe), ioe); |
| | | new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.DOWNLOAD_ERROR, |
| | | getExceptionMsg("downloading-error", arg, ioe), ioe); |
| | | } catch (Throwable t) |
| | | { |
| | | // This is a bug |
| | | ex = |
| | | new ApplicationException(ApplicationException.Type.BUG, |
| | | new ApplicationException(ApplicationReturnCode.ReturnCode.BUG, |
| | | getExceptionMsg( |
| | | "bug-msg", t), t); |
| | | } |
| | |
| | | public void downloadFailed(URL url, String version) |
| | | { |
| | | ex = |
| | | new ApplicationException(ApplicationException.Type.DOWNLOAD_ERROR, |
| | | getMsg("downloading-error", new String[] { url.toString() }), null); |
| | | new ApplicationException( |
| | | ApplicationReturnCode.ReturnCode.DOWNLOAD_ERROR, getMsg( |
| | | "downloading-error", new String[] { url.toString() }), null); |
| | | } |
| | | |
| | | /** |