Skip to content

Commit 49bc808

Browse files
authored
Convert error prone string comparisons to shell script conditional (#419)
1 parent 46b393a commit 49bc808

File tree

7 files changed

+147
-147
lines changed

7 files changed

+147
-147
lines changed

installer/src/main/bin/createDomain.sh

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@
1818
# This script uses the following command-line arguments directly, the rest
1919
# of the arguments are passed down to the underlying python program:
2020
#
21-
# - -oracle_home The directory of the existing Oracle Home to use.
22-
# This directory must exist and it is the caller's
23-
# responsibility to verify that it does. This
24-
# argument is required.
21+
# -oracle_home The directory of the existing Oracle Home to use.
22+
# This directory must exist and it is the caller's
23+
# responsibility to verify that it does. This
24+
# argument is required.
2525
#
26-
# - -domain_type The type of domain to create. This argument is
27-
# is optional. If not specified, it defaults to WLS.
26+
# -domain_type The type of domain to create. This argument is
27+
# is optional. If not specified, it defaults to WLS.
2828
#
29-
# - -wlst_path The path to the Oracle Home product directory under
30-
# which to find the wlst.cmd script. This is only
31-
# needed for pre-12.2.1 upper stack products like SOA.
29+
# -wlst_path The path to the Oracle Home product directory under
30+
# which to find the wlst script. This is only
31+
# needed for pre-12.2.1 upper stack products like SOA.
3232
#
33-
# For example, for SOA 12.1.3, -wlst_path should be
34-
# specified as $ORACLE_HOME/soa
33+
# For example, for SOA 12.1.3, -wlst_path should be
34+
# specified as $ORACLE_HOME/soa
3535
#
3636
# This script uses the following variables:
3737
#
38-
# JAVA_HOME - The location of the JDK to use. The caller must set
39-
# this variable to a valid Java 7 (or later) JDK.
38+
# JAVA_HOME - The location of the JDK to use. The caller must set
39+
# this variable to a valid Java 7 (or later) JDK.
4040
#
4141
# WLSDEPLOY_HOME - The location of the WLS Deploy installation.
4242
# If the caller sets this, the callers location will be
@@ -120,7 +120,7 @@ umask 27
120120

121121
WLSDEPLOY_PROGRAM_NAME="createDomain"; export WLSDEPLOY_PROGRAM_NAME
122122

123-
if [ "${WLSDEPLOY_HOME}" = "" ]; then
123+
if [ -z "${WLSDEPLOY_HOME}" ]; then
124124
BASEDIR="$( cd "$( dirname $0 )" && pwd )"
125125
WLSDEPLOY_HOME=`cd "${BASEDIR}/.." ; pwd`
126126
export WLSDEPLOY_HOME
@@ -133,7 +133,7 @@ fi
133133
# Make sure that the JAVA_HOME environment variable is set to point to a
134134
# JDK 7 or higher JVM (and that it isn't OpenJDK).
135135
#
136-
if [ "${JAVA_HOME}" = "" ]; then
136+
if [ -z "${JAVA_HOME}" ]; then
137137
echo "Please set the JAVA_HOME environment variable to point to a Java 7 installation" >&2
138138
exit 2
139139
elif [ ! -d "${JAVA_HOME}" ]; then
@@ -228,7 +228,7 @@ fi
228228
# Check for values of required arguments for this script to continue.
229229
# The underlying WLST script has other required arguments.
230230
#
231-
if [ "${ORACLE_HOME}" = "" ]; then
231+
if [ -z "${ORACLE_HOME}" ]; then
232232
echo "Required argument -oracle_home not provided" >&2
233233
usage `basename $0`
234234
exit 99
@@ -238,9 +238,9 @@ elif [ ! -d ${ORACLE_HOME} ]; then
238238
fi
239239

240240
#
241-
# If the WLST_PATH_DIR is specified, validate that it contains the wlst.cmd script
241+
# If the WLST_PATH_DIR is specified, validate that it contains the wlst.sh script
242242
#
243-
if [ "${WLST_PATH_DIR}" != "" ]; then
243+
if [ -n "${WLST_PATH_DIR}" ]; then
244244
if [ ! -d ${WLST_PATH_DIR} ]; then
245245
echo "Specified -wlst_path directory does not exist: ${WLST_PATH_DIR}" >&2
246246
exit 98
@@ -270,7 +270,7 @@ else
270270
fi
271271

272272

273-
if [ "${WLST}" = "" ]; then
273+
if [ -z "${WLST}" ]; then
274274
echo "Unable to determine WLS version in ${ORACLE_HOME} to determine WLST shell script to call" >&2
275275
exit 98
276276
fi
@@ -282,15 +282,15 @@ WLST_PROPERTIES=-Dcom.oracle.cie.script.throwException=true
282282
WLST_PROPERTIES="-Djava.util.logging.config.class=${LOG_CONFIG_CLASS} ${WLST_PROPERTIES} ${WLSDEPLOY_PROPERTIES}"
283283
export WLST_PROPERTIES
284284

285-
if [ "${WLSDEPLOY_LOG_PROPERTIES}" = "" ]; then
285+
if [ -z "${WLSDEPLOY_LOG_PROPERTIES}" ]; then
286286
WLSDEPLOY_LOG_PROPERTIES=${WLSDEPLOY_HOME}/etc/logging.properties; export WLSDEPLOY_LOG_PROPERTIES
287287
fi
288288

289-
if [ "${WLSDEPLOY_LOG_DIRECTORY}" = "" ]; then
289+
if [ -z "${WLSDEPLOY_LOG_DIRECTORY}" ]; then
290290
WLSDEPLOY_LOG_DIRECTORY=${WLSDEPLOY_HOME}/logs; export WLSDEPLOY_LOG_DIRECTORY
291291
fi
292292

293-
if [ "${WLSDEPLOY_LOG_HANDLERS}" = "" ]; then
293+
if [ -z "${WLSDEPLOY_LOG_HANDLERS}" ]; then
294294
WLSDEPLOY_LOG_HANDLERS=${WLSDEPLOY_LOG_HANDLER}; export WLSDEPLOY_LOG_HANDLERS
295295
fi
296296

installer/src/main/bin/deployApps.sh

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@
1616
# This script uses the following command-line arguments directly, the rest
1717
# of the arguments are passed down to the underlying python program:
1818
#
19-
# - -oracle_home The directory of the existing Oracle Home to use.
20-
# This directory must exist and it is the caller's
21-
# responsibility to verify that it does. This
22-
# argument is required.
19+
# -oracle_home The directory of the existing Oracle Home to use.
20+
# This directory must exist and it is the caller's
21+
# responsibility to verify that it does. This
22+
# argument is required.
2323
#
24-
# - -domain_type The type of domain to create. This argument is
25-
# is optional. If not specified, it defaults to WLS.
24+
# -domain_type The type of domain to create. This argument is
25+
# is optional. If not specified, it defaults to WLS.
2626
#
27-
# - -wlst_path The path to the Oracle Home product directory under
28-
# which to find the wlst.cmd script. This is only
29-
# needed for pre-12.2.1 upper stack products like SOA.
27+
# -wlst_path The path to the Oracle Home product directory under
28+
# which to find the wlst script. This is only
29+
# needed for pre-12.2.1 upper stack products like SOA.
3030
#
31-
# For example, for SOA 12.1.3, -wlst_path should be
32-
# specified as $ORACLE_HOME/soa
31+
# For example, for SOA 12.1.3, -wlst_path should be
32+
# specified as $ORACLE_HOME/soa
3333
#
3434
# This script uses the following variables:
3535
#
36-
# JAVA_HOME - The location of the JDK to use. The caller must set
37-
# this variable to a valid Java 7 (or later) JDK.
36+
# JAVA_HOME - The location of the JDK to use. The caller must set
37+
# this variable to a valid Java 7 (or later) JDK.
3838
#
3939
# WLSDEPLOY_HOME - The location of the WLS Deploy installation.
4040
# If the caller sets this, the callers location will be
@@ -97,7 +97,7 @@ umask 27
9797

9898
WLSDEPLOY_PROGRAM_NAME="deployApps"; export WLSDEPLOY_PROGRAM_NAME
9999

100-
if [ "${WLSDEPLOY_HOME}" = "" ]; then
100+
if [ -z "${WLSDEPLOY_HOME}" ]; then
101101
BASEDIR="$( cd "$( dirname $0 )" && pwd )"
102102
WLSDEPLOY_HOME=`cd "${BASEDIR}/.." ; pwd`
103103
export WLSDEPLOY_HOME
@@ -110,7 +110,7 @@ fi
110110
# Make sure that the JAVA_HOME environment variable is set to point to a
111111
# JDK 7 or higher JVM (and that it isn't OpenJDK).
112112
#
113-
if [ "${JAVA_HOME}" = "" ]; then
113+
if [ -z "${JAVA_HOME}" ]; then
114114
echo "Please set the JAVA_HOME environment variable to point to a Java 7 installation" >&2
115115
exit 2
116116
elif [ ! -d "${JAVA_HOME}" ]; then
@@ -206,7 +206,7 @@ fi
206206
# Check for values of required arguments for this script to continue.
207207
# The underlying WLST script has other required arguments.
208208
#
209-
if [ "${ORACLE_HOME}" = "" ]; then
209+
if [ -z "${ORACLE_HOME}" ]; then
210210
echo "Required argument -oracle_home not provided" >&2
211211
usage `basename $0`
212212
exit 99
@@ -216,9 +216,9 @@ elif [ ! -d ${ORACLE_HOME} ]; then
216216
fi
217217

218218
#
219-
# If the WLST_PATH_DIR is specified, validate that it contains the wlst.cmd script
219+
# If the WLST_PATH_DIR is specified, validate that it contains the wlst.sh script
220220
#
221-
if [ "${WLST_PATH_DIR}" != "" ]; then
221+
if [ -n "${WLST_PATH_DIR}" ]; then
222222
if [ ! -d ${WLST_PATH_DIR} ]; then
223223
echo "Specified -wlst_path directory does not exist: ${WLST_PATH_DIR}" >&2
224224
exit 98
@@ -247,7 +247,7 @@ else
247247
CLASSPATH=${WLSDEPLOY_HOME}/lib/weblogic-deploy-core.jar; export CLASSPATH
248248
fi
249249

250-
if [ "${WLST}" = "" ]; then
250+
if [ -z "${WLST}" ]; then
251251
echo "Unable to determine WLS version in ${ORACLE_HOME} to determine WLST shell script to call" >&2
252252
exit 98
253253
fi
@@ -259,15 +259,15 @@ WLST_PROPERTIES=-Dcom.oracle.cie.script.throwException=true
259259
WLST_PROPERTIES="-Djava.util.logging.config.class=${LOG_CONFIG_CLASS} ${WLST_PROPERTIES} ${WLSDEPLOY_PROPERTIES}"
260260
export WLST_PROPERTIES
261261

262-
if [ "${WLSDEPLOY_LOG_PROPERTIES}" = "" ]; then
262+
if [ -z "${WLSDEPLOY_LOG_PROPERTIES}" ]; then
263263
WLSDEPLOY_LOG_PROPERTIES=${WLSDEPLOY_HOME}/etc/logging.properties; export WLSDEPLOY_LOG_PROPERTIES
264264
fi
265265

266-
if [ "${WLSDEPLOY_LOG_DIRECTORY}" = "" ]; then
266+
if [ -z "${WLSDEPLOY_LOG_DIRECTORY}" ]; then
267267
WLSDEPLOY_LOG_DIRECTORY=${WLSDEPLOY_HOME}/logs; export WLSDEPLOY_LOG_DIRECTORY
268268
fi
269269

270-
if [ "${WLSDEPLOY_LOG_HANDLERS}" = "" ]; then
270+
if [ -z "${WLSDEPLOY_LOG_HANDLERS}" ]; then
271271
WLSDEPLOY_LOG_HANDLERS=${WLSDEPLOY_LOG_HANDLER}; export WLSDEPLOY_LOG_HANDLERS
272272
fi
273273

installer/src/main/bin/discoverDomain.sh

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@
1717
# This script uses the following command-line arguments directly, the rest
1818
# of the arguments are passed down to the underlying python program:
1919
#
20-
# - -oracle_home The directory of the existing Oracle Home to use.
21-
# This directory must exist and it is the caller's
22-
# responsibility to verify that it does. This
23-
# argument is required.
20+
# -oracle_home The directory of the existing Oracle Home to use.
21+
# This directory must exist and it is the caller's
22+
# responsibility to verify that it does. This
23+
# argument is required.
2424
#
25-
# - -domain_type The type of domain to create. This argument is
26-
# is optional. If not specified, it defaults to WLS.
25+
# -domain_type The type of domain to create. This argument is
26+
# is optional. If not specified, it defaults to WLS.
2727
#
28-
# - -wlst_path The path to the Oracle Home product directory under
29-
# which to find the wlst.cmd script. This is only
30-
# needed for pre-12.2.1 upper stack products like SOA.
28+
# -wlst_path The path to the Oracle Home product directory under
29+
# which to find the wlst script. This is only
30+
# needed for pre-12.2.1 upper stack products like SOA.
3131
#
32-
# For example, for SOA 12.1.3, -wlst_path should be
33-
# specified as $ORACLE_HOME/soa
32+
# For example, for SOA 12.1.3, -wlst_path should be
33+
# specified as $ORACLE_HOME/soa
3434
#
3535
# This script uses the following variables:
3636
#
37-
# JAVA_HOME - The location of the JDK to use. The caller must set
38-
# this variable to a valid Java 7 (or later) JDK.
37+
# JAVA_HOME - The location of the JDK to use. The caller must set
38+
# this variable to a valid Java 7 (or later) JDK.
3939
#
4040
# WLSDEPLOY_HOME - The location of the WLS Deploy installation.
4141
# If the caller sets this, the callers location will be
@@ -87,7 +87,7 @@ umask 27
8787

8888
WLSDEPLOY_PROGRAM_NAME="discoverDomain"; export WLSDEPLOY_PROGRAM_NAME
8989

90-
if [ "${WLSDEPLOY_HOME}" = "" ]; then
90+
if [ -z "${WLSDEPLOY_HOME}" ]; then
9191
BASEDIR="$( cd "$( dirname $0 )" && pwd )"
9292
WLSDEPLOY_HOME=`cd "${BASEDIR}/.." ; pwd`
9393
export WLSDEPLOY_HOME
@@ -100,7 +100,7 @@ fi
100100
# Make sure that the JAVA_HOME environment variable is set to point to a
101101
# JDK 7 or higher JVM (and that it isn't OpenJDK).
102102
#
103-
if [ "${JAVA_HOME}" = "" ]; then
103+
if [ -z "${JAVA_HOME}" ]; then
104104
echo "Please set the JAVA_HOME environment variable to point to a Java 7 installation" >&2
105105
exit 2
106106
elif [ ! -d "${JAVA_HOME}" ]; then
@@ -183,7 +183,7 @@ fi
183183
# Check for values of required arguments for this script to continue.
184184
# The underlying WLST script has other required arguments.
185185
#
186-
if [ "${ORACLE_HOME}" = "" ]; then
186+
if [ -z "${ORACLE_HOME}" ]; then
187187
echo "Required argument -oracle_home not provided" >&2
188188
usage `basename $0`
189189
exit 99
@@ -193,9 +193,9 @@ elif [ ! -d ${ORACLE_HOME} ]; then
193193
fi
194194

195195
#
196-
# If the WLST_PATH_DIR is specified, validate that it contains the wlst.cmd script
196+
# If the WLST_PATH_DIR is specified, validate that it contains the wlst.sh script
197197
#
198-
if [ "${WLST_PATH_DIR}" != "" ]; then
198+
if [ -n "${WLST_PATH_DIR}" ]; then
199199
if [ ! -d ${WLST_PATH_DIR} ]; then
200200
echo "Specified -wlst_path directory does not exist: ${WLST_PATH_DIR}" >&2
201201
exit 98
@@ -224,7 +224,7 @@ else
224224
CLASSPATH=${WLSDEPLOY_HOME}/lib/weblogic-deploy-core.jar; export CLASSPATH
225225
fi
226226

227-
if [ "${WLST}" = "" ]; then
227+
if [ -z "${WLST}" ]; then
228228
echo "Unable to determine WLS version in ${ORACLE_HOME} to determine WLST shell script to call" >&2
229229
exit 98
230230
fi
@@ -236,15 +236,15 @@ WLST_PROPERTIES=-Dcom.oracle.cie.script.throwException=true
236236
WLST_PROPERTIES="-Djava.util.logging.config.class=${LOG_CONFIG_CLASS} ${WLST_PROPERTIES} ${WLSDEPLOY_PROPERTIES}"
237237
export WLST_PROPERTIES
238238

239-
if [ "${WLSDEPLOY_LOG_PROPERTIES}" = "" ]; then
239+
if [ -z "${WLSDEPLOY_LOG_PROPERTIES}" ]; then
240240
WLSDEPLOY_LOG_PROPERTIES=${WLSDEPLOY_HOME}/etc/logging.properties; export WLSDEPLOY_LOG_PROPERTIES
241241
fi
242242

243-
if [ "${WLSDEPLOY_LOG_DIRECTORY}" = "" ]; then
243+
if [ -z "${WLSDEPLOY_LOG_DIRECTORY}" ]; then
244244
WLSDEPLOY_LOG_DIRECTORY=${WLSDEPLOY_HOME}/logs; export WLSDEPLOY_LOG_DIRECTORY
245245
fi
246246

247-
if [ "${WLSDEPLOY_LOG_HANDLERS}" = "" ]; then
247+
if [ -z "${WLSDEPLOY_LOG_HANDLERS}" ]; then
248248
WLSDEPLOY_LOG_HANDLERS=${WLSDEPLOY_LOG_HANDLER}; export WLSDEPLOY_LOG_HANDLERS
249249
fi
250250

0 commit comments

Comments
 (0)