From c40f084a6d3e897785f2fbff3ddb97545644cddc Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 11 Dec 2006 15:34:39 +0000
Subject: [PATCH] The following modifications include the comments from Neil and Brian (thanks to both for your help):
---
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java | 66 ++++++---------------------------
1 files changed, 12 insertions(+), 54 deletions(-)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java b/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
index e6bbdf7..e9ac9fd 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -27,7 +27,6 @@
package org.opends.quicksetup.installer.offline;
-import java.io.File;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
@@ -38,7 +37,6 @@
import org.opends.quicksetup.installer.UserInstallData;
import org.opends.quicksetup.util.ProgressMessageFormatter;
import org.opends.quicksetup.util.Utils;
-import org.opends.server.util.SetupUtils;
/**
* This is an implementation of the Installer class that is used to install
@@ -56,8 +54,6 @@
*/
public class OfflineInstaller extends Installer
{
- private static String fullInstallPath;
-
/* This map contains the ratio associated with each step */
private HashMap<InstallProgressStep, Integer> hmRatio =
new HashMap<InstallProgressStep, Integer>();
@@ -68,39 +64,6 @@
private InstallProgressStep status;
- static
- {
- /* Get the install path from the Class Path */
- String sep = System.getProperty("path.separator");
- String[] classPaths = System.getProperty("java.class.path").split(sep);
- String path = null;
- for (int i = 0; i < classPaths.length && (path == null); i++)
- {
- for (int j = 0; j < OPEN_DS_JAR_RELATIVE_PATHS.length &&
- (path == null); j++)
- {
- String normPath = classPaths[i].replace(File.separatorChar, '/');
- if (normPath.endsWith(OPEN_DS_JAR_RELATIVE_PATHS[j]))
- {
- path = classPaths[i];
- }
- }
- }
- File f = new File(path);
- File binariesDir = f.getParentFile();
- fullInstallPath = binariesDir.getParent();
- }
- /**
- * A constant used to retrieve the full install path.
- */
- public static String FULL_INSTALL_PATH = fullInstallPath;
-
- /**
- * A constant used to retrieve the config file name.
- */
- public static String CONFIG_FILE_NAME =
- Utils.getPath(FULL_INSTALL_PATH, CONFIG_PATH_RELATIVE);
-
/**
* OfflineInstaller constructor.
* @param userData the UserInstallData with the parameters provided by the
@@ -141,7 +104,7 @@
}
/**
- * Actually performs the start in this thread. The thread is blocked.
+ * Actually performs the install in this thread. The thread is blocked.
*
*/
private void doInstall()
@@ -175,12 +138,7 @@
break;
}
- try
- {
- // This isn't likely to happen, and it's not a serious problem even if
- // it does.
- SetupUtils.writeSetJavaHome(FULL_INSTALL_PATH);
- } catch (Exception e) {}
+ writeJavaHome();
if (getUserData().getStartServer())
{
@@ -205,6 +163,14 @@
String html = getFormattedError(ex, true);
notifyListeners(html);
}
+ catch (Throwable t)
+ {
+ status = InstallProgressStep.FINISHED_WITH_ERROR;
+ InstallException ex = new InstallException(
+ InstallException.Type.BUG, getThrowableMsg("bug-msg", t), t);
+ String msg = getFormattedError(ex, true);
+ notifyListeners(msg);
+ }
}
/**
@@ -290,17 +256,9 @@
/**
* {@inheritDoc}
*/
- protected String getConfigFilePath()
+ protected String getInstallationPath()
{
- return CONFIG_FILE_NAME;
- }
-
- /**
- * {@inheritDoc}
- */
- protected String getBinariesPath()
- {
- return Utils.getPath(FULL_INSTALL_PATH, BINARIES_PATH_RELATIVE);
+ return Utils.getInstallPathFromClasspath();
}
/**
--
Gitblit v1.10.0