Skip to content

Commit 95743c4

Browse files
Merge pull request #241 from oracle/jira-wdt-006-no-model
JIRA WDT-006 Log descriptive error for case where model is not found
2 parents b550af0 + ff2ca2f commit 95743c4

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

core/src/main/python/create.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
The Universal Permissive License (UPL), Version 1.0
44
55
The main module for the WLSDeploy tool to create empty domains.
@@ -193,8 +193,15 @@ def __process_model_args(optional_arg_map):
193193
try:
194194
archive_file = WLSDeployArchive(archive_file_name)
195195
__tmp_model_dir = FileUtils.createTempDirectory(_program_name)
196-
tmp_model_file = \
197-
FileUtils.fixupFileSeparatorsForJython(archive_file.extractModel(__tmp_model_dir).getAbsolutePath())
196+
tmp_model_raw_file = archive_file.extractModel(__tmp_model_dir)
197+
if not tmp_model_raw_file:
198+
ex = exception_helper.create_cla_exception('WLSDPLY-20026', _program_name, archive_file_name,
199+
CommandLineArgUtil.MODEL_FILE_SWITCH)
200+
ex.setExitCode(CommandLineArgUtil.ARG_VALIDATION_ERROR_EXIT_CODE)
201+
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
202+
raise ex
203+
204+
tmp_model_file = FileUtils.fixupFileSeparatorsForJython(tmp_model_raw_file.getAbsolutePath())
198205
except (IllegalArgumentException, IllegalStateException, WLSDeployArchiveIOException), archex:
199206
ex = exception_helper.create_cla_exception('WLSDPLY-20010', _program_name, archive_file_name,
200207
archex.getLocalizedMessage(), error=archex)

core/src/main/python/deploy.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
The Universal Permissive License (UPL), Version 1.0
44
55
The entry point for the deployApps tool.
@@ -171,8 +171,15 @@ def __process_model_args(optional_arg_map):
171171
try:
172172
archive_file = WLSDeployArchive(archive_file_name)
173173
__tmp_model_dir = FileUtils.createTempDirectory(_program_name)
174-
model_file_name = \
175-
FileUtils.fixupFileSeparatorsForJython(archive_file.extractModel(__tmp_model_dir).getAbsolutePath())
174+
tmp_model_raw_file = archive_file.extractModel(__tmp_model_dir)
175+
if not tmp_model_raw_file:
176+
ex = exception_helper.create_cla_exception('WLSDPLY-20026', _program_name, archive_file_name,
177+
CommandLineArgUtil.MODEL_FILE_SWITCH)
178+
ex.setExitCode(CommandLineArgUtil.ARG_VALIDATION_ERROR_EXIT_CODE)
179+
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
180+
raise ex
181+
182+
model_file_name = FileUtils.fixupFileSeparatorsForJython(tmp_model_raw_file.getAbsolutePath())
176183
except (IllegalArgumentException, IllegalStateException, WLSDeployArchiveIOException), archex:
177184
ex = exception_helper.create_cla_exception('WLSDPLY-20010', _program_name, archive_file_name,
178185
archex.getLocalizedMessage(), error=archex)

core/src/main/python/update.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
The Universal Permissive License (UPL), Version 1.0
44
55
The entry point for the updateDomain tool.
@@ -183,8 +183,15 @@ def __process_model_args(optional_arg_map):
183183
try:
184184
archive_file = WLSDeployArchive(archive_file_name)
185185
__tmp_model_dir = FileUtils.createTempDirectory(_program_name)
186-
model_file_name = \
187-
FileUtils.fixupFileSeparatorsForJython(archive_file.extractModel(__tmp_model_dir).getAbsolutePath())
186+
tmp_model_raw_file = archive_file.extractModel(__tmp_model_dir)
187+
if not tmp_model_raw_file:
188+
ex = exception_helper.create_cla_exception('WLSDPLY-20026', _program_name, archive_file_name,
189+
CommandLineArgUtil.MODEL_FILE_SWITCH)
190+
ex.setExitCode(CommandLineArgUtil.ARG_VALIDATION_ERROR_EXIT_CODE)
191+
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
192+
raise ex
193+
194+
model_file_name = FileUtils.fixupFileSeparatorsForJython(tmp_model_raw_file.getAbsolutePath())
188195
except (IllegalArgumentException, IllegalStateException, WLSDeployArchiveIOException), archex:
189196
ex = exception_helper.create_cla_exception('WLSDPLY-20010', _program_name, archive_file_name,
190197
archex.getLocalizedMessage(), error=archex)

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,7 @@ WLSDPLY-20022=Error loading filter path {0}
12541254
WLSDPLY-20023={0} unable to add model file {1} to archive as {2}: {3}
12551255
WLSDPLY-20024={0} failed to persist the model to the archive file {1}: {2}
12561256
WLSDPLY-20025=For {0}, specify the {1} or {2} argument, but not both
1257+
WLSDPLY-20026={0} failed to find a model file in archive {1}, and {2} argument not specified
12571258

12581259
# Common messages used for tool exit and clean-up
12591260
WLSDPLY-21000={0} Messages:

0 commit comments

Comments
 (0)