From b3c63571f6cd697072a0c3dd816c44923bf39fe2 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 20 Jul 2007 15:24:15 +0000
Subject: [PATCH] Fix for issue 1986.
---
opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties | 2 ++
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java | 4 ++++
opends/resource/setup.bat | 13 +++++++++++++
3 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/opends/resource/setup.bat b/opends/resource/setup.bat
index 1dec017..8fd0f24 100644
--- a/opends/resource/setup.bat
+++ b/opends/resource/setup.bat
@@ -27,6 +27,12 @@
setlocal
+rem check that the path does not contain the ^% character which breaks
+rem the batch files.
+set NON_ESCAPED=%~dPs0..
+FOR /F "tokens=1-2* delims=%%" %%1 IN ("%NON_ESCAPED%") DO (
+if NOT "%%2" == "" goto invalidPath)
+
set DIR_HOME=%~dP0.
set INSTANCE_ROOT=%DIR_HOME%
@@ -34,6 +40,13 @@
if "%JAVA_BIN%" == "" goto noJavaBin
goto setClassPath
+:invalidPath
+echo Error: The current path contains a %% character. OpenDS cannot
+echo be installed on a path containing this character.
+pause
+goto end
+
+
:noJavaBin
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index b8dc41b..8be784f 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -2419,6 +2419,10 @@
errorMsgs.add(getMsg("not-enough-disk-space", args));
qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true);
+ } else if (Utils.isWindows() && (serverLocation.indexOf("%") != -1))
+ {
+ errorMsgs.add(getMsg("invalid-char-in-path", "%"));
+ qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true);
} else
{
getUserData().setServerLocation(serverLocation);
diff --git a/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties b/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
index 87f042b..04e8abc 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
+++ b/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
@@ -241,6 +241,8 @@
You must have file right access on the Installation directory.
not-enough-disk-space=There is not enough free disk space under {0}.\nAt \
least {1} megabytes of free disk space are required to install OpenDS.
+invalid-char-in-path=The path contains the character "{0}" which is not \
+allowed to install OpenDS.
empty-host-name=You must provide the name of the host.
invalid-port-value-range=The LDAP Listener Port must be an integer between \
{0} and {1}.
--
Gitblit v1.10.0