opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Application.java
@@ -72,11 +72,11 @@ * denoted by the System property * <code>org.opends.quicksetup.Application.class</code>. * @return Application object that was newly instantiated * @throws org.opends.quicksetup.ApplicationException if there was a problem * @throws RuntimeException if there was a problem * creating the new Application object */ static public GuiApplication create() throws ApplicationException { throws RuntimeException { GuiApplication app; String appClassName = System.getProperty("org.opends.quicksetup.Application.class"); @@ -88,25 +88,25 @@ } catch (ClassNotFoundException e) { LOG.log(Level.INFO, "error creating quicksetup application", e); String msg = "Application class " + appClass + " not found"; throw new ApplicationException(ApplicationException.Type.BUG, msg, e); throw new RuntimeException(msg, e); } catch (IllegalAccessException e) { LOG.log(Level.INFO, "error creating quicksetup application", e); String msg = "Could not access class " + appClass; throw new ApplicationException(ApplicationException.Type.BUG, msg, e); throw new RuntimeException(msg, e); } catch (InstantiationException e) { LOG.log(Level.INFO, "error creating quicksetup application", e); String msg = "Error instantiating class " + appClass; throw new ApplicationException(ApplicationException.Type.BUG, msg, e); throw new RuntimeException(msg, e); } catch (ClassCastException e) { String msg = "The class indicated by the system property " + "'org.opends.quicksetup.Application.class' must " + " must be of type Application"; throw new ApplicationException(ApplicationException.Type.BUG, msg, e); throw new RuntimeException(msg, e); } } else { String msg = "System property 'org.opends.quicksetup.Application.class'" + " must specify class quicksetup application"; throw new ApplicationException(ApplicationException.Type.BUG, msg, null); throw new RuntimeException(msg); } return app; } @@ -567,6 +567,10 @@ return ui; } static private String getMessage(String key, String... args) { return ResourceProvider.getInstance().getMsg(key, args); } /** * This class is used to notify the ProgressUpdateListeners of events * that are written to the standard error. It is used in WebStartInstaller opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java
@@ -101,7 +101,7 @@ } } catch (IOException e) { throw new ApplicationException(ApplicationException.Type.START_ERROR, "Error creating build info", e); getMsg("error-creating-build-info"), e); } finally { if (is != null) { try { @@ -353,10 +353,14 @@ for (String prop : props) { if (null == values.get(prop)) { throw new ApplicationException(ApplicationException.Type.TOOL_ERROR, "'" + prop + "' could not be determined", null); getMsg("error-prop-value", prop), null); } } } static private String getMsg(String key, String... args) { return ResourceProvider.getInstance().getMsg(key, args); } } opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
@@ -978,6 +978,44 @@ using it. error-copying-file=Error copying file {0} to {1}. info-ignoring-file=Ignoring {0} since {1} exists. # Upgrade errors error-failed-to-create-stage-directory=Failed to create staging directory {0}. error-determining-custom-config=Error determining configuration customizations. error-determining-custom-schema=Error determining schema customizations. error-deleting-stage-directory=Error deleting stage directory {0}. error-bad-stage-directory=Directory {0} does not contain a staged installation \ of OpenDS as was expected. Verify that the new installation package (.zip) \ is an OpenDS installation file and that you have write access permission for \ this directory. error-determining-current-build=Error determining current build information. error-determining-upgrade-build=Error determining upgrade build information. error-upgrading-components=Error upgrading components. error-logging-operation=Error writting operation details to log. error-applying-custom-config=Error applying configuration customizations to server. error-applying-custom-schema=Error applying schema customizations to server. error-backup-db=Error backing up databases. error-backup-filesystem=Error backing up files. error-initializing-upgrade=Error initializing upgrade. error-artificial=Artificial error. error-port-in-use=The server can not be started as another application is using \ port {0}. Check that you have access to this port before restarting the server. error-server-status=Error determining the server's status. error-server-health-check-failure=Server health check failed. error-upgraded-server-starts-with-errors=The upgraded server starts with errors: {0} # General errors error-failed-moving-file=Failed to move file {0} to {1}. error-prop-value=The value of property {0} could not be determined. error-creating-build-info=Error determining OpenDS build information. error-determining-svn-rev=Error determining installation's Subversion revision number. error-determining-server-state=Failed to determine the server's state. error-backup-db-tool-return-code=The backup tool returned error code {0}. error-ldif-diff-tool-return-code=The LDIF diff tool returned error code {0}. error-apply-ldif-modify=Error processing modification operation of {0}: {1} error-apply-ldif-add=Error processing add operation of {0}: {1} error-apply-ldif-delete=Error processing delete operation of {0}: {1} # # Install Status: messages displayed in the offline quick setup # if server is already installed. @@ -1009,6 +1047,13 @@ (schema checking disabled): {0} upgrade-mod=Processed server modifications: {0} upgrade-mod-ignore=Attribute or value already exists: {0} upgrade-canceled=Upgrade canceled. upgrade-verification-failure-title=Upgrade Verification Failed upgrade-verification-failure-prompt=The upgraded server returned errors on \ startup. Would you like to cancel the upgrade? If you cancel, any changes \ made to the server by this upgrade will be backed out. upgrade-verification-failure-cancel=Cancel Upgrade upgrade-verification-failure-view-details=View Error Details # # Upgrader Panels opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
@@ -491,8 +491,7 @@ ipsc.disableConnectionHandlers(true); ipsc.startServer(); } catch (IOException e) { String msg = "Failed to determine server state: " + e.getLocalizedMessage(); String msg = getMsg("error-determining-server-state"); LOG.log(Level.INFO, msg, e); throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR, msg, e); opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
@@ -101,23 +101,17 @@ public void initialize(String[] args) { ProgressMessageFormatter formatter = new HtmlProgressMessageFormatter(); try { installStatus = new CurrentInstallStatus(); application = Application.create(); application.setProgressMessageFormatter(formatter); application.setCurrentInstallStatus(installStatus); installStatus = new CurrentInstallStatus(); initLookAndFeel(); application = Application.create(); application.setProgressMessageFormatter(formatter); application.setCurrentInstallStatus(installStatus); /* In the calls to setCurrentStep the dialog will be created */ setCurrentStep(application.getFirstWizardStep()); initLookAndFeel(); } catch (ApplicationException e) { LOG.log(Level.INFO, "error", e); throw new RuntimeException("failed to create quicksetup application", e); } /* In the calls to setCurrentStep the dialog will be created */ setCurrentStep(application.getFirstWizardStep()); } /** opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
@@ -162,9 +162,9 @@ fm.deleteRecursively(stageDir); } if (!stageDir.mkdirs()) { // TODO: i18n throw ApplicationException.createFileSystemException( "failed to create staging directory " + stageDir, null); String msg = getMsg("error-failed-to-create-stage-directory", Utils.getPath(stageDir)); throw ApplicationException.createFileSystemException(msg, null); } LOG.log(Level.INFO, "stage directory " + stageDir.getPath()); return stageDir; opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeOracle.java
@@ -87,7 +87,7 @@ * @return String representing a localized message giving a summary of * this hypothetical operation. */ public String getSummaryMessage() { public String getLocalizedSummaryMessage() { String msg; String[] args = { currentBuildInfo.toString(), currentBuildInfo.toString() }; opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -885,7 +885,7 @@ "Error starting server in order to apply custom" + "schema and/or configuration", e); throw new ApplicationException(ApplicationException.Type.APPLICATION, "Error starting server:" + e.getLocalizedMessage(), e); getMsg("error-starting-server"), e); } checkAbort(); @@ -940,7 +940,7 @@ } catch (Throwable t) { LOG.log(Level.INFO, "Error stopping server", t); throw new ApplicationException(ApplicationException.Type.BUG, "Error stopping server in process", t); getMsg("error-stopping-server"), t); } } @@ -953,7 +953,7 @@ System.getProperty(SYS_PROP_CREATE_ERROR))) { LOG.log(Level.WARNING, "creating artificial error"); throw new ApplicationException( null, "ARTIFICIAL ERROR FOR TESTING ABORT PROCESS", null); null, getMsg("error-artificial"), null); } LOG.log(Level.INFO, "verifying upgrade"); @@ -981,26 +981,23 @@ Utils.listToString(errors, sep, /*bullet=*/"\u2022 ", ""); runWarning = new ApplicationException( ApplicationException.Type.APPLICATION, "Upgraded server failed verification test by signaling " + "errors during startup:" + sep + formattedDetails, null); String cancel = "Cancel Upgrade"; getMsg("error-upgraded-server-starts-with-errors", sep + formattedDetails), null); String cancel = getMsg("upgrade-verification-failure-cancel"); UserInteraction ui = userInteraction(); if (ui == null || cancel.equals(ui.confirm( "Upgrade Verification Failed", "The upgraded server returned errors on startup. Would " + "you like to cancel the upgrade? If you cancel, " + "any changes made to the server by this upgrade " + "will be backed out.", getMsg("upgrade-verification-failure-title"), getMsg("upgrade-verification-failure-prompt"), formattedDetails, "Upgrade Error", getMsg("upgrade-verification-failure-title"), UserInteraction.MessageType.ERROR, new String[] { "Continue", cancel }, cancel, "View Error Details"))) { new String[] { getMsg("continue-button-label"), cancel }, cancel, getMsg("upgrade-verification-failure-view-details")))) { cancel(); throw new ApplicationException( ApplicationException.Type.APPLICATION, "Upgrade canceled", null); getMsg("upgrade-canceled"), null); } } else { notifyListeners(formatter.getFormattedDone() + @@ -1024,10 +1021,8 @@ if (port != -1 && !Utils.canUseAsPort(port)) { throw new ApplicationException( ApplicationException.Type.APPLICATION, "The server can not be started as another application " + "is using port " + port + ". Check that you " + "have access to this port before restarting " + "the server.", null); getMsg("error-port-in-use", Integer.toString(port)), null); } control.startServer(true); notifyListeners(formatter.getFormattedDone() + @@ -1056,7 +1051,7 @@ LOG.log(Level.INFO, "error determining if server running"); this.runWarning = new ApplicationException( ApplicationException.Type.TOOL_ERROR, "Error determining whether or not server running", ioe); getMsg("error-server-status"), ioe); } } catch (ApplicationException ae) { @@ -1064,8 +1059,7 @@ } catch (Throwable t) { this.runError = new ApplicationException(ApplicationException.Type.BUG, "Unexpected error: " + t.getLocalizedMessage(), t); getMsg("bug-msg"), t); } finally { try { HistoricalRecord.Status status; @@ -1183,7 +1177,7 @@ private void checkAbort() throws ApplicationException { if (abort) throw new ApplicationException( ApplicationException.Type.APPLICATION, "Upgrade canceled", null); getMsg("upgrade-canceled"), null); } /** @@ -1260,15 +1254,8 @@ getInstallation()).modify(configDiff); } } catch (IOException e) { String msg = "I/O Error applying configuration customization: " + e.getLocalizedMessage(); LOG.log(Level.INFO, msg, e); throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR, msg, e); } catch (Exception e) { String msg = "Error applying configuration customization: " + e.getLocalizedMessage(); String msg = getMsg("error-applying-custom-config"); LOG.log(Level.INFO, msg, e); throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR, msg, e); @@ -1282,15 +1269,8 @@ new InProcessServerController( getInstallation()).modify(schemaDiff); } } catch (IOException e) { String msg = "I/O Error applying schema customization: " + e.getLocalizedMessage(); LOG.log(Level.INFO, msg, e); throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR, msg, e); } catch (Exception e) { String msg = "Error applying schema customization: " + e.getLocalizedMessage(); String msg = getMsg("error-applying-custom-schema"); LOG.log(Level.INFO, msg, e); throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR, msg, e); @@ -1308,7 +1288,7 @@ id = log.append(fromVersion, toVersion, HistoricalRecord.Status.STARTED, null); } catch (IOException e) { String msg = "I/O Error logging operation: " + e.getLocalizedMessage(); String msg = getMsg("error-logging-operation"); throw ApplicationException.createFileSystemException( msg, e); } @@ -1327,7 +1307,7 @@ new HistoricalLog(getInstallation().getHistoryLogFile()); log.append(id, from, to, status, note); } catch (IOException e) { String msg = "Error logging operation: " + e.getLocalizedMessage(); String msg = getMsg("error-logging-operation"); throw ApplicationException.createFileSystemException(msg, e); } } @@ -1353,7 +1333,7 @@ } catch (IOException e) { throw ApplicationException.createFileSystemException( "I/0 error upgrading components: " + e.getLocalizedMessage(), e); getMsg("error-upgrading-components"), e); } } @@ -1370,44 +1350,37 @@ getCustomConfigDiffFile()); } catch (Exception e) { throw ApplicationException.createFileSystemException( "Error determining configuration customizations: " + e.getLocalizedMessage(), e); getMsg("error-determining-custom-config"), e); } } else { LOG.log(Level.INFO, "No configuration customizations to migrate"); } } catch (IOException e) { // TODO i18n throw ApplicationException.createFileSystemException( "Could not determine configuration modifications: " + e.getLocalizedMessage(), e); getMsg("error-determining-custom-config"), e); } return isCustom; } private void ldifDiff(File source, File target, File output) throws ApplicationException { throws ApplicationException, IOException, InterruptedException { ExternalTools et = new ExternalTools(getInstallation()); try { String[] args = new String[] { "-o", Utils.getPath(output), "-O", }; OperationOutput oo = et.ldifDiff(source, target, args); int ret = oo.getReturnCode(); if (ret != 0) { throw new ApplicationException( ApplicationException.Type.TOOL_ERROR, "ldif-diff tool returned error code " + ret, null); } } catch (Exception e) { String[] args = new String[]{ "-o", Utils.getPath(output), "-O", }; OperationOutput oo = et.ldifDiff(source, target, args); int ret = oo.getReturnCode(); if (ret != 0) { throw new ApplicationException( ApplicationException.Type.TOOL_ERROR, "Error performing determining customizations", e); getMsg("error-ldif-diff-tool-return-code", Integer.toString(ret)), null); } } private boolean calculateSchemaCustomizations() throws ApplicationException { boolean isCustom = false; if (getInstallation().getStatus().schemaHasBeenModified()) { @@ -1420,8 +1393,7 @@ getCustomSchemaDiffFile()); } catch (Exception e) { throw ApplicationException.createFileSystemException( "Error determining schema customizations: " + e.getLocalizedMessage(), e); getMsg("error-determining-custom-schema"), e); } } else { LOG.log(Level.INFO, "No schema customizations to migrate"); @@ -1443,7 +1415,7 @@ } catch (Exception e) { throw new ApplicationException( ApplicationException.Type.FILE_SYSTEM_ERROR, e.getLocalizedMessage(), getMsg("error-backup-filesystem"), e); } } @@ -1456,14 +1428,15 @@ if (ret != 0) { throw new ApplicationException( ApplicationException.Type.TOOL_ERROR, "backup tool returned error code " + ret, getMsg("error-backup-db-tool-return-code", Integer.toString(ret)), null); } } catch (Exception e) { throw new ApplicationException( ApplicationException.Type.TOOL_ERROR, "Error backing up databases", e); getMsg("error-backup-db"), e); } } @@ -1487,12 +1460,9 @@ } } catch (IOException e) { // TODO i18n throw ApplicationException.createFileSystemException( "Error attempting to clean up tmp directory " + stagingDir != null ? stagingDir.getName() : "null" + ": " + e.getLocalizedMessage(), e); getMsg("error-deleting-stage-directory", Utils.getPath(stagingDir)), e); } } @@ -1512,7 +1482,7 @@ } catch (Exception e) { throw new ApplicationException( ApplicationException.Type.FILE_SYSTEM_ERROR, e.getMessage(), e); getMsg("error-initializing-upgrade"), e); } } @@ -1531,8 +1501,7 @@ } catch (ApplicationException e) { LOG.log(Level.INFO, "error", e); throw ApplicationException.createFileSystemException( "Could not determine current build information: " + e.getLocalizedMessage(), e); getMsg("error-determining-current-build"), e); } try { @@ -1540,14 +1509,12 @@ } catch (Exception e) { LOG.log(Level.INFO, "error", e); throw ApplicationException.createFileSystemException( "Could not determine upgrade build information: " + e.getLocalizedMessage(), e); } getMsg("error-determining-upgrade-build"), e); } UpgradeOracle uo = new UpgradeOracle(currentVersion, newVersion); if (!uo.isSupported()) { throw new ApplicationException(ApplicationException.Type.APPLICATION, uo.getSummaryMessage(), null); uo.getLocalizedSummaryMessage(), null); } } @@ -1560,13 +1527,9 @@ Installation.validateRootDirectory(stageDir); stagedInstallation = new Installation(getStageDirectory()); } catch (IllegalArgumentException e) { throw ApplicationException.createFileSystemException( "Directory '" + getStageDirectory() + "' does not contain a staged installation of OpenDS" + " as was expected. Verify that the new installation" + " package (.zip) is an OpenDS installation file and" + " that you have write access permission for this " + " directory.", null); String msg = getMsg("error-bad-stage-directory", Utils.getPath(getStageDirectory())); throw ApplicationException.createFileSystemException(msg, e); } } return stagedInstallation; opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
@@ -530,7 +530,10 @@ } if (!objectFile.renameTo(destination)) { throw ApplicationException.createFileSystemException( "failed to move " + objectFile + " to " + destination, null); getMsg("error-failed-moving-file", Utils.getPath(objectFile), Utils.getPath(destination)), null); } } } opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java
@@ -28,6 +28,7 @@ package org.opends.quicksetup.util; import org.opends.quicksetup.*; import org.opends.quicksetup.i18n.ResourceProvider; import org.opends.server.loggers.debug.TextDebugLogPublisher; import org.opends.server.loggers.debug.DebugLogger; import org.opends.server.loggers.TextErrorLogPublisher; @@ -407,9 +408,8 @@ StringBuilder error = op.getErrorMessage(); throw new ApplicationException( ApplicationException.Type.IMPORT_ERROR, "error processing modification of '" + dnByteString + "': " + error != null ? error.toString() : "", getMsg("error-apply-ldif-modify", dnByteString.toString(), error != null ? error.toString() : ""), null); } break; @@ -431,9 +431,8 @@ StringBuilder error = addOp.getErrorMessage(); throw new ApplicationException( ApplicationException.Type.IMPORT_ERROR, "error processing add of '" + dnByteString + "': " + error != null ? error.toString() : "", getMsg("error-apply-ldif-add", dnByteString.toString(), error != null ? error.toString() : ""), null); } break; @@ -449,22 +448,21 @@ StringBuilder error = delOp.getErrorMessage(); throw new ApplicationException( ApplicationException.Type.IMPORT_ERROR, "error processing delete of '" + dnByteString + "': " + error != null ? error.toString() : "", getMsg("error-apply-ldif-delete", dnByteString.toString(), error != null ? error.toString() : ""), null); } break; default: throw new ApplicationException( ApplicationException.Type.IMPORT_ERROR, "unexpected change record type " + cre.getClass(), LOG.log(Level.SEVERE, "Unexpected record type " + cre.getClass()); throw new ApplicationException(ApplicationException.Type.BUG, getMsg("bug-msg"), null); } } } catch (Throwable t) { throw new ApplicationException(ApplicationException.Type.BUG, t.getMessage(), t); getMsg("bug-msg"), t); } } @@ -519,4 +517,8 @@ AccessLogger.removeAccessLogPublisher(DN.NULL_DN); } static private String getMsg(String key, String... args) { return ResourceProvider.getInstance().getMsg(key, args); } } opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerHealthChecker.java
@@ -29,6 +29,7 @@ import org.opends.quicksetup.Installation; import org.opends.quicksetup.ApplicationException; import org.opends.quicksetup.i18n.ResourceProvider; import org.opends.server.util.ServerConstants; import java.util.List; @@ -85,7 +86,8 @@ throw (ApplicationException)e; } else { throw new ApplicationException(ApplicationException.Type.APPLICATION, "Server health check failed: " + e.getLocalizedMessage(), e); ResourceProvider.getInstance().getMsg( "error-server-health-check-failure"), e); } } finally { if (control != null) { opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -177,22 +177,26 @@ */ public static String getPath(File f) { try { /* * Do a best effort to avoid having a relative representation (for * instance to avoid having ../../../). */ File canonical = f.getCanonicalFile(); f = canonical; String path = null; if (f != null) { try { /* * Do a best effort to avoid having a relative representation (for * instance to avoid having ../../../). */ File canonical = f.getCanonicalFile(); f = canonical; } catch (IOException ioe) { /* This is a best effort to get the best possible representation of the * file: reporting the error is not necessary. */ } path = f.toString(); } catch (IOException ioe) { /* This is a best effort to get the best possible representation of the * file: reporting the error is not necessary. */ } return f.toString(); return path; } /**