From cd35330cd4f8ec3e9648dc18820ab0500bbeba92 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 17 Dec 2007 20:01:36 +0000
Subject: [PATCH] Fix a bug in the dsjavaproperties when calculating the default values for the files. The bug prevented the Java WebStart installer to create set-java-home.
---
opendj-sdk/opends/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java | 45 ++++++++++++++++++++++++++++++++++++++-------
1 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java b/opendj-sdk/opends/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java
index b0e9096..0f33b2a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java
@@ -165,15 +165,34 @@
// Use this instead of Installation.getLocal() because making that call
// starts a new JVM and the command-line becomes less responsive.
String root = Utils.getInstallPathFromClasspath();
- String libDir = Utils.getPath(root, Installation.LIBRARIES_PATH_RELATIVE);
- if (Utils.isWindows())
+ if (root != null)
{
- value = Utils.getPath(libDir,
- Installation.SET_JAVA_PROPERTIES_FILE_WINDOWS);
+ String libDir = Utils.getPath(root, Installation.LIBRARIES_PATH_RELATIVE);
+ if (Utils.isWindows())
+ {
+ value = Utils.getPath(libDir,
+ Installation.SET_JAVA_PROPERTIES_FILE_WINDOWS);
+ }
+ else
+ {
+ value = Utils.getPath(libDir,
+ Installation.SET_JAVA_PROPERTIES_FILE_UNIX);
+ }
}
else
{
- value = Utils.getPath(libDir, Installation.SET_JAVA_PROPERTIES_FILE_UNIX);
+ // This can happen when we are not launched using the command-line (for
+ // instance from the WebInstaller).
+ if (Utils.isWindows())
+ {
+ value = Utils.getPath(Installation.LIBRARIES_PATH_RELATIVE,
+ Installation.SET_JAVA_PROPERTIES_FILE_WINDOWS);
+ }
+ else
+ {
+ value = Utils.getPath(Installation.LIBRARIES_PATH_RELATIVE,
+ Installation.SET_JAVA_PROPERTIES_FILE_UNIX);
+ }
}
return value;
}
@@ -185,10 +204,22 @@
*/
private static String getDefaultPropertiesValue()
{
+ String defaultPropertiesValue;
// Use this instead of Installation.getLocal() because making that call
// starts a new JVM and the command-line becomes less responsive.
String root = Utils.getInstallPathFromClasspath();
- String configDir = Utils.getPath(root, Installation.CONFIG_PATH_RELATIVE);
- return Utils.getPath(configDir, Installation.DEFAULT_JAVA_PROPERTIES_FILE);
+ if (root != null)
+ {
+ String configDir = Utils.getPath(root, Installation.CONFIG_PATH_RELATIVE);
+ defaultPropertiesValue = Utils.getPath(configDir,
+ Installation.DEFAULT_JAVA_PROPERTIES_FILE);
+ }
+ else
+ {
+ // This can happen when we are not launched using the command-line (for
+ // instance from the WebInstaller).
+ defaultPropertiesValue = Installation.DEFAULT_JAVA_PROPERTIES_FILE;
+ }
+ return defaultPropertiesValue;
}
}
\ No newline at end of file
--
Gitblit v1.10.0