From b7bbff3851444b4390c87e23a846c5bdcab2700f Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 25 Apr 2007 12:35:08 +0000
Subject: [PATCH] Fix for issue 1273 (exception if JAVA_HOME undefined in scripts).

---
 opends/resource/bin/stop-ds |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/opends/resource/bin/stop-ds b/opends/resource/bin/stop-ds
index 8269397..6a531ec 100755
--- a/opends/resource/bin/stop-ds
+++ b/opends/resource/bin/stop-ds
@@ -104,6 +104,25 @@
 SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=stop-ds"
 export SCRIPT_NAME_ARG
 
+# Test that the provided JDK is 1.5 compatible.
+if test -z "${JAVA_ARGS}"
+then
+  "${JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
+  if test ${?} -ne 0
+  then
+    echo "ERROR:  The detected Java version could not be used.  Please set "
+    echo "        JAVA_HOME to the root of a Java 5.0 installation."
+    exit 1
+  fi
+else
+  "${JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
+  if test ${?} -ne 0
+  then
+    echo "ERROR:  The detected Java version could not be used with the specified"
+    echo "Java arguments.  Please set  JAVA_HOME to the root of a Java 5.0 installation."
+    exit 1
+  fi
+fi
 
 "${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
   org.opends.server.tools.StopDS --checkStoppability "${@}"

--
Gitblit v1.10.0