From 567cef647cc0ad3e6d8531ba22f408e6e018ec14 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Thu, 03 Jan 2008 13:17:54 +0000
Subject: [PATCH] Fix the broken java properties tool when the user specifies not to overwrite the environment java argument properties.

---
 opends/src/server/org/opends/server/tools/JavaPropertiesTool.java |    3 +
 opends/resource/config/java.properties                            |   85 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+), 1 deletions(-)

diff --git a/opends/resource/config/java.properties b/opends/resource/config/java.properties
new file mode 100644
index 0000000..a67e371
--- /dev/null
+++ b/opends/resource/config/java.properties
@@ -0,0 +1,85 @@
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE
+# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+# add the following below this CDDL HEADER, with the fields enclosed
+# by brackets "[]" replaced with your own identifying information:
+#      Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#      Portions Copyright 2007 Sun Microsystems, Inc.
+#
+#
+
+#
+# This file contains the java properties that the different command lines will
+# use when launched.  You can specify the location of the java binaries to be
+# used and the java arguments to be passed to the command line.
+# For instance you can specify to use the -server argument for the start-ds
+# command with an initial heap size of 256 Mb by setting
+# start-ds.java-args=-server -Xms256m
+# (the example assumes that the Java virtual machine supports those options).
+#
+# To set the java virtual machine to be used for a given command-line you must
+# set the property <command-line-name>.java-home and to specify java arguments
+# you must set the property <command-line-name>.java-args.
+#
+# There are certain command-lines (import-ldif, export-ldif, backup, restore)
+# that can work on two modes: online and offline.  When they run in online mode
+# (the server is running and the user specifies LDAP parameters to launch the
+# operation) the operation is not actually performed in the Java Virtual Machine
+# of the command-line but on the server side.  This is why when launching these
+# command-lines on online-mode it is preferred to use the -client argument for
+# the java virtual machine (and even limit the maximum size of the heap).
+# However when these command-lines are launched in offline mode it is
+# recommended to use the -server argument to launch the command-line.
+# This is the reason why you can specify different java properties for both
+# modes (for instance import-ldif.offline.java-args and
+# import-ldif.online.java-args).
+#
+# IMPORTANT NOTE: Once you have modified this file and set the java properties
+# that you want the command-lines to use you must run the command-line
+# bin/dsjavaproperties for the different scripts to be updated with the
+# specified settings.
+#
+# Examples:
+# Specify to overwrite the content of the environment variable OPENDS_JAVA_HOME
+# (i.e. the contents of this properties file for the java home will be analyzed
+# before checking whether OPENDS_JAVA_HOME is specified in the environment):
+# overwrite-env-java-home=true
+#
+# Specify to overwrite the content of the environment variable OPENDS_JAVA_ARGS
+# (i.e. the contents of this properties file for the java args will be analyzed
+# before checking whether OPENDS_JAVA_ARGS is specified in the environment):
+# overwrite-env-java-args=true
+#
+# Specify to use a particular Java Virtual Machine for the offline import:
+# import-ldif.offline.java-home=/usr/jdk1.7
+#
+# Specify to use -client argument when running dsconfig:
+# dsconfig.java-args=-client
+#
+# Specify to use -server argument when running import-ldif on server mode:
+# import-ldif.offline.java-args=-server
+#
+# Specify to use the java home for all the command-lines that have not
+# an associated property defined:
+# default.java-home=/usr/jdk1.5
+#
+# Specify to use the -client argument for all the command-lines that have not
+# an associated property defined:
+# default.java-args=-client
+
diff --git a/opends/src/server/org/opends/server/tools/JavaPropertiesTool.java b/opends/src/server/org/opends/server/tools/JavaPropertiesTool.java
index 57d4b65..c6da665 100644
--- a/opends/src/server/org/opends/server/tools/JavaPropertiesTool.java
+++ b/opends/src/server/org/opends/server/tools/JavaPropertiesTool.java
@@ -646,6 +646,7 @@
           EOL+
           "# See if the environment variables for arguments are set."+EOL+
           "if test -z \"${OPENDS_JAVA_ARGS}\""+EOL+
+          "then"+EOL+
           "  if test -z \"${JAVA_ARGS}\""+EOL);
     }
 
@@ -727,7 +728,7 @@
     }
     if (nIfs > 0)
     {
-      String s = overwriteJavaArgs? "":"  ";
+      String s = overwriteJavaArgs? "":"    ";
       buf.append(s+"fi"+EOL);
     }
 

--
Gitblit v1.10.0