Skip to content

Commit 5556880

Browse files
Merge pull request #1030 from oracle/issue-#1025-split-classpath
Discover large classpath attribute values
2 parents 9f99162 + 6c245ce commit 5556880

File tree

3 files changed

+19
-31
lines changed

3 files changed

+19
-31
lines changed

core/src/main/python/wlsdeploy/aliases/aliases.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,8 @@ def get_wlst_attribute_name_and_value(self, location, model_attribute_name, mode
476476

477477
if attribute_info and not self.__is_wlst_attribute_read_only(location, attribute_info):
478478
wlst_attribute_name = attribute_info[WLST_NAME]
479-
480-
if self._model_context and USES_PATH_TOKENS in attribute_info and \
481-
string_utils.to_boolean(attribute_info[USES_PATH_TOKENS]):
482-
model_attribute_value = self._model_context.replace_token_string(model_attribute_value)
479+
uses_path_tokens = USES_PATH_TOKENS in attribute_info and \
480+
string_utils.to_boolean(attribute_info[USES_PATH_TOKENS])
483481

484482
data_type = attribute_info[WLST_TYPE]
485483
if data_type == 'password':
@@ -514,6 +512,11 @@ def get_wlst_attribute_name_and_value(self, location, model_attribute_name, mode
514512
model_val = alias_utils.convert_to_type(LIST, model_attribute_value,
515513
delimiter=MODEL_LIST_DELIMITER)
516514

515+
if uses_path_tokens:
516+
for index, item in enumerate(model_val):
517+
item_value = self._model_context.replace_token_string(str(item))
518+
model_val[index] = item_value
519+
517520
_read_type, read_delimiter = \
518521
alias_utils.compute_read_data_type_and_delimiter_from_attribute_info(
519522
attribute_info, existing_wlst_value)
@@ -539,6 +542,9 @@ def get_wlst_attribute_name_and_value(self, location, model_attribute_name, mode
539542
wlst_attribute_value = alias_utils.convert_to_type(data_type, merged_value,
540543
delimiter=MODEL_LIST_DELIMITER)
541544
else:
545+
if uses_path_tokens:
546+
model_attribute_value = self._model_context.replace_token_string(model_attribute_value)
547+
542548
wlst_attribute_value = alias_utils.convert_to_type(data_type, model_attribute_value,
543549
delimiter=MODEL_LIST_DELIMITER)
544550

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55

66
import copy
77
import os
8+
import re
89
import tempfile
910

1011
import java.net.URI as URI
1112

1213
from oracle.weblogic.deploy.util import XPathUtil
14+
from wlsdeploy.aliases.model_constants import MODEL_LIST_DELIMITER
1315
from wlsdeploy.aliases.wlst_modes import WlstModes
1416
from wlsdeploy.logging import platform_logger
1517
from wlsdeploy.util import validate_configuration
@@ -898,14 +900,17 @@ def tokenize_classpath(self, classpath):
898900
"""
899901
Replace known types of directories with a tokens that represent the directory.
900902
901-
:param classpath: containing a string of directories separated by environment specific classpath separator
903+
:param classpath: containing a string of directories separated by commas
902904
:return: tokenized classpath string
903905
"""
904-
cp_elements, separator = path_utils.split_classpath(classpath)
906+
cp_elements = classpath.split(MODEL_LIST_DELIMITER)
905907
for index, value in enumerate(cp_elements):
908+
path_is_windows = '\\' in value or re.match('^[a-zA-Z][:]', value)
909+
if path_is_windows:
910+
value = path_utils.fixup_path(value)
906911
cp_elements[index] = self.tokenize_path(value)
907912

908-
return separator.join(cp_elements)
913+
return MODEL_LIST_DELIMITER.join(cp_elements)
909914

910915
def copy(self, arg_map):
911916
model_context_copy = copy.copy(self)

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

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
"""
2-
Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2022, Oracle Corporation and/or its affiliates. All rights reserved.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55
import os
6-
import re
76

87
import java.io.File as JFile
98

@@ -17,28 +16,6 @@
1716
_class_name = 'path_utils'
1817

1918

20-
def split_classpath(classpath):
21-
"""
22-
Split the classpath string into a list of classpath directories. The classpath string will be split around
23-
the environment specific file separator token.
24-
:param classpath: string of token separated directories and files representing the classpath
25-
:return: list of classpath nodes
26-
"""
27-
classpath_is_windows = False
28-
# This is not a definitive test but it tests the cases we care about...
29-
if '\\' in classpath or ';' in classpath or re.match('^[a-zA-Z][:]', classpath):
30-
classpath_is_windows = True
31-
32-
if classpath_is_windows:
33-
my_classpath = fixup_path(classpath)
34-
separator = ';'
35-
else:
36-
my_classpath = classpath
37-
separator = ':'
38-
39-
return my_classpath.split(separator), separator
40-
41-
4219
def fixup_path(path):
4320
"""
4421
Standardize the path, replacing the back slashes with forward slash. This is more suitable for wlst

0 commit comments

Comments
 (0)