Skip to content

Commit efcfbc1

Browse files
preventing the misleading log entry from being written at startup (#1382)
1 parent 6c07628 commit efcfbc1

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

core/src/main/java/oracle/weblogic/deploy/util/XPathUtil.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ private static synchronized XPathFactory factory() {
8080
*/
8181
public String getPSU() {
8282
// find the names in the directory first
83-
if (!(new File(patchesHome)).exists()) {
83+
if (StringUtils.isEmpty(oracleHome)) {
84+
LOGGER.fine("Cannot detect PSU version since Oracle Home is empty");
85+
return null;
86+
} else if (!(new File(patchesHome)).exists()) {
8487
LOGGER.fine("No PSU, patches directory not found at {0}", patchesHome);
8588
return null;
8689
}

core/src/main/python/wlsdeploy/util/model_context.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ModelContext(object):
4242

4343
DB_USER_DEFAULT = 'SYS'
4444

45-
def __init__(self, program_name, arg_map):
45+
def __init__(self, program_name, arg_map=None):
4646
"""
4747
Create a new model context instance.
4848
Tools should use model_context_helper.create_context(), to ensure that the typedef is initialized correctly.
@@ -112,11 +112,25 @@ def __init__(self, program_name, arg_map):
112112
if self._wlst_mode is None:
113113
self._wlst_mode = WlstModes.OFFLINE
114114

115-
self.__copy_from_args(arg_map)
115+
# This if test is for the tool_main's creation of the exit_context, which is
116+
# used for argument parsing in case an error is raised. The issue is that
117+
# __copy_from_args tries to determine the PSU version but since the Oracle Home
118+
# is not available, the PSU detection logic and erroneously logs that there is
119+
# no PSU when there is (and that gets logged about 70 lines down in the log file).
120+
#
121+
if arg_map is not None:
122+
self.__copy_from_args(arg_map)
116123

117124
def __copy_from_args(self, arg_map):
118125
_method_name = '__copy_from_args'
119-
if CommandLineArgUtil.ORACLE_HOME_SWITCH in arg_map:
126+
127+
# No need to try to get the PSU if the -oracle_home is empty...
128+
#
129+
# This is yet another special case where something during the loading of
130+
# the typedef file creates a sparse model_context object with the -oracle_home
131+
# set to an empty string.
132+
#
133+
if CommandLineArgUtil.ORACLE_HOME_SWITCH in arg_map and len(arg_map[CommandLineArgUtil.ORACLE_HOME_SWITCH]) > 0:
120134
self._oracle_home = arg_map[CommandLineArgUtil.ORACLE_HOME_SWITCH]
121135
psu = XPathUtil(self._oracle_home).getPSU()
122136
if psu is not None:

0 commit comments

Comments
 (0)