opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/UserDataException.java
@@ -30,7 +30,7 @@ /** * This exception is used when there is an error with the data provided by * the user. It will be thrown by the class that is in charge of validating * the user data (QuickSetup). * the user data (the Application class). * */ public class UserDataException extends Exception opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -906,8 +906,10 @@ * */ private void updateUserDataForServerSettingsPanel(QuickSetup qs) throws UserDataException { throws UserDataException { ArrayList<String> errorMsgs = new ArrayList<String>(); String confirmationMsg = null; if (Utils.isWebStart()) { @@ -918,12 +920,61 @@ { errorMsgs.add(getMsg("empty-server-location")); qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true); } else if (!Utils.parentDirectoryExists(serverLocation)) } else if (!Utils.parentDirectoryExists(serverLocation)) { String existingParentDirectory = null; File f = new File(serverLocation); while ((existingParentDirectory == null) && (f != null)) { f = f.getParentFile(); if ((f != null) && f.exists()) { if (f.isDirectory()) { existingParentDirectory = f.getAbsolutePath(); } else { // The parent path is a file! f = null; } } } if (existingParentDirectory == null) { String[] arg = { serverLocation }; errorMsgs.add(getMsg("parent-directory-does-not-exist", arg)); errorMsgs.add(getMsg("parent-directory-could-not-be-found", arg)); qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true); } else { if (!Utils.canWrite(existingParentDirectory)) { String[] arg = { existingParentDirectory }; errorMsgs.add(getMsg("directory-not-writable", arg)); qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true); } else if (!Utils.hasEnoughSpace(existingParentDirectory, getRequiredInstallSpace())) { long requiredInMb = getRequiredInstallSpace() / (1024 * 1024); String[] args = { existingParentDirectory, String.valueOf(requiredInMb) }; errorMsgs.add(getMsg("not-enough-disk-space", args)); qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true); } else { String[] arg = { serverLocation }; confirmationMsg = getMsg("parent-directory-does-not-exist-confirmation", arg); getUserData().setServerLocation(serverLocation); } } } else if (Utils.fileExists(serverLocation)) { String[] arg = @@ -1113,6 +1164,11 @@ throw new UserDataException(Step.SERVER_SETTINGS, Utils.getStringFromCollection(errorMsgs, "\n")); } if (confirmationMsg != null) { throw new UserDataConfirmationException(Step.SERVER_SETTINGS, confirmationMsg); } } /** opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -28,6 +28,7 @@ package org.opends.quicksetup.installer.webstart; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.util.ArrayList; @@ -111,6 +112,7 @@ notifyListeners(getTaskSeparator()); status = InstallProgressStep.EXTRACTING; createParentDirectoryIfRequired(); extractZipFiles(in, getRatio(InstallProgressStep.EXTRACTING), getRatio(InstallProgressStep.CONFIGURING_SERVER)); notifyListeners(getTaskSeparator()); @@ -360,6 +362,37 @@ } /** * Creates the parent Directory for the server location if it does not exist. * @throws QuickSetupException if something goes wrong. */ private void createParentDirectoryIfRequired() throws QuickSetupException { String serverLocation = getUserData().getServerLocation(); if (!Utils.parentDirectoryExists(serverLocation)) { File f = new File(serverLocation); String parent = f.getParent(); try { if (!Utils.createDirectory(parent)) { throw new QuickSetupException( QuickSetupException.Type.FILE_SYSTEM_ERROR, getMsg("error-could-not-create-parent-dir", new String[] {parent}), null); } } catch (IOException ioe) { throw new QuickSetupException( QuickSetupException.Type.FILE_SYSTEM_ERROR, getMsg("error-could-not-create-parent-dir", new String[] {parent}), ioe); } } } /** * This method extracts the zip file. * @param is the inputstream with the contents of the zip file. * @param minRatio the value of the ratio in the install that corresponds to opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
@@ -235,6 +235,11 @@ error-title=Error # # Confirmation dialog title # confirmation-title=Confirmation Required # # Error when we cannot launch the status panel # could-not-launch-status-panel-msg=An unexpected error occurred launching the \ @@ -275,7 +280,9 @@ # # Server Settings empty-server-location=You must provide the installation path. parent-directory-does-not-exist=The parent directory of {0} does not exist. parent-directory-could-not-be-found=Could not find a parent directory for {0}. parent-directory-does-not-exist-confirmation=The parent directory of {0} does \ not exist.\nWould you like to create this directory? file-exists=The file {0} already exists. directory-exists-not-empty=The directory {0} is not empty. directory-not-writable=You do not have write access on the directory {0}. \ @@ -737,6 +744,8 @@ exception-details=Details: {0} exception-out-of-memory-details=Not enough memory to perform the operation. \ Details: {0} error-could-not-create-parent-dir=Could not create parent directory {0}. \ Check that you have file system access rights. downloading-error=An error occurred downloading remote file(s) {0}. error-zipinputstreamnull=Could not retrieve zip file {0}. The input stream \ is null. opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
@@ -278,7 +278,18 @@ if (throwable != null) { UserDataException ude = (UserDataException) throwable; if (ude instanceof UserDataConfirmationException) { if (displayConfirmation(ude.getLocalizedMessage(), getMsg("confirmation-title"))) { setCurrentStep(application.getNextWizardStep(cStep)); } } else { displayError(ude.getLocalizedMessage(), getMsg("error-title")); } } else { setCurrentStep(application.getNextWizardStep(cStep)); } @@ -448,18 +459,6 @@ * The following three methods are just commodity methods to get localized * messages. * @param key String key * @param args String[] args * @return String message */ private String getMsg(String key, String[] args) { return getI18n().getMsg(key, args); } /** * The following three methods are just commodity methods to get localized * messages. * @param key String key * @param t Throwable throwable * @return String message */