diff --git a/core/src/main/java/oracle/weblogic/deploy/util/PyOrderedDict.java b/core/src/main/java/oracle/weblogic/deploy/util/PyOrderedDict.java index df94a3879..1977385af 100644 --- a/core/src/main/java/oracle/weblogic/deploy/util/PyOrderedDict.java +++ b/core/src/main/java/oracle/weblogic/deploy/util/PyOrderedDict.java @@ -280,9 +280,10 @@ public void __setitem__(PyObject key, PyObject value) { synchronized (this.linkedHashMap) { this.linkedHashMap.put(key, value); } - synchronized (super.table) { - super.table.put(key, value); - } + // do not access protected field directly. + // 2.7 version does not have table variable. + // Neither version has synchronization on the table. + super.__setitem__(key, value); } /** @@ -291,7 +292,7 @@ public void __setitem__(PyObject key, PyObject value) { @Override public void clear() { this.linkedHashMap.clear(); - super.table.clear();; + super.clear(); } /** @@ -503,6 +504,7 @@ private static PyObject doDeepCopy(PyObject orig, PyObject memo) { case "long": case "NoneType": case "str": + case "unicode": result = orig; break; diff --git a/core/src/main/python/create.py b/core/src/main/python/create.py index 985b1e4b8..f70e1aba7 100644 --- a/core/src/main/python/create.py +++ b/core/src/main/python/create.py @@ -4,7 +4,7 @@ The main module for the WLSDeploy tool to create empty domains. """ -import javaos as os +import os import sys from java.io import IOException from java.lang import IllegalArgumentException @@ -487,6 +487,6 @@ def main(args): return -if __name__ == "main": +if __name__ == '__main__' or __name__ == 'main': WebLogicDeployToolingVersion.logVersionInfo(_program_name) main(sys.argv) diff --git a/core/src/main/python/deploy.py b/core/src/main/python/deploy.py index d1468b545..e66852c2e 100644 --- a/core/src/main/python/deploy.py +++ b/core/src/main/python/deploy.py @@ -4,7 +4,7 @@ The entry point for the deployApps tool. """ -import javaos as os +import os import sys from java.io import IOException, PrintStream @@ -437,6 +437,6 @@ def main(args): return -if __name__ == "main": +if __name__ == '__main__' or __name__ == 'main': WebLogicDeployToolingVersion.logVersionInfo(_program_name) main(sys.argv) diff --git a/core/src/main/python/discover.py b/core/src/main/python/discover.py index 9d153f7a1..1e831ab59 100644 --- a/core/src/main/python/discover.py +++ b/core/src/main/python/discover.py @@ -4,7 +4,7 @@ The entry point for the discoverDomain tool. """ -import javaos as os +import os import sys from java.io import File @@ -525,6 +525,6 @@ def main(args): __log_and_exit(model_context, exit_code, _class_name, _method_name) -if __name__ == 'main': +if __name__ == '__main__' or __name__ == 'main': WebLogicDeployToolingVersion.logVersionInfo(_program_name) main(sys.argv) diff --git a/core/src/main/python/encrypt.py b/core/src/main/python/encrypt.py index 6b2b64733..c0856ce75 100644 --- a/core/src/main/python/encrypt.py +++ b/core/src/main/python/encrypt.py @@ -4,7 +4,7 @@ The main module for the WLSDeploy tool to encrypt passwords. """ -import javaos as os +import os import sys from java.io import IOException @@ -285,6 +285,6 @@ def main(args): sys.exit(exit_code) -if __name__ == "main": +if __name__ == '__main__' or __name__ == 'main': WebLogicDeployToolingVersion.logVersionInfo(_program_name) main(sys.argv) diff --git a/core/src/main/python/update.py b/core/src/main/python/update.py index 845d5aba4..8b8c74b44 100644 --- a/core/src/main/python/update.py +++ b/core/src/main/python/update.py @@ -4,7 +4,7 @@ The entry point for the updateDomain tool. """ -import javaos as os +import os import sys from java.io import IOException, PrintStream @@ -454,6 +454,6 @@ def main(args): return -if __name__ == "main": +if __name__ == '__main__' or __name__ == 'main': WebLogicDeployToolingVersion.logVersionInfo(_program_name) main(sys.argv) diff --git a/core/src/main/python/validate.py b/core/src/main/python/validate.py index 2eef80c98..546d7737e 100644 --- a/core/src/main/python/validate.py +++ b/core/src/main/python/validate.py @@ -4,7 +4,7 @@ The WLS Deploy tooling entry point for the validateModel tool. """ -import javaos as os +import os import sys from java.util.logging import Level @@ -254,6 +254,6 @@ def main(args): return -if __name__ == "main": +if __name__ == '__main__' or __name__ == 'main': WebLogicDeployToolingVersion.logVersionInfo(_program_name) main(sys.argv) diff --git a/core/src/main/python/variable_inject.py b/core/src/main/python/variable_inject.py index 87b65161c..0ded8ef2f 100644 --- a/core/src/main/python/variable_inject.py +++ b/core/src/main/python/variable_inject.py @@ -310,6 +310,6 @@ def main(args): __logger.exiting(result=exit_code, class_name=_class_name, method_name=_method_name) sys.exit(exit_code) -if __name__ == 'main': +if __name__ == '__main__' or __name__ == 'main': WebLogicDeployToolingVersion.logVersionInfo(_program_name) main(sys.argv) diff --git a/core/src/main/python/wlsdeploy/aliases/alias_utils.py b/core/src/main/python/wlsdeploy/aliases/alias_utils.py index d37a8d94d..ad020ea07 100644 --- a/core/src/main/python/wlsdeploy/aliases/alias_utils.py +++ b/core/src/main/python/wlsdeploy/aliases/alias_utils.py @@ -74,10 +74,10 @@ def merge_model_and_existing_lists(model_list, existing_list, string_list_separa result = model_list elif model_list is None or len(model_list) == 0: result = existing_list - if type(model_list) is str and type(existing_list) is not str: + if isinstance(model_list, basestring) and not isinstance(existing_list, basestring): result = string_list_separator_char.join(existing_list) else: - model_list_is_string = type(model_list) is str + model_list_is_string = isinstance(model_list, basestring) model_set = _create_set(model_list, string_list_separator_char, 'WLSDPLY-08000') existing_set = _create_set(existing_list, string_list_separator_char, 'WLSDPLY-08001') @@ -107,7 +107,7 @@ def merge_model_and_existing_properties(model_props, existing_props, string_prop result = model_props elif model_props is None or len(model_props) == 0: result = existing_props - if type(model_props) is str and type(existing_props) is not str: + if isinstance(model_props, basestring) and isinstance(existing_props, basestring): result = _properties_to_string(existing_props, string_props_separator_char) else: model_props_is_string = False @@ -517,7 +517,7 @@ def convert_boolean(value): result = True elif value == 0: result = False - elif type(value) is str: + elif isinstance(value, basestring): if value.lower() == 'true': result = True elif value.lower() == 'false': @@ -844,7 +844,7 @@ def _get_path_separator(value): _logger.entering(value, class_name=_class_name, method_name=_method_name) result = File.pathSeparator - if type(value) is str and len(value) > 0: + if isinstance(value, basestring) and len(value) > 0: # If the value has a windows separator or a single directory that starts with a drive letter if ';' in value or _windows_path_regex.match(value): result = ';' @@ -972,7 +972,7 @@ def _properties_to_string(props, string_props_separator_char): _logger.entering(props, string_props_separator_char, class_name=_class_name, method_name=_method_name) if props is None: result = '' - elif type(props) is str: + elif isinstance(props, basestring): result = props else: result = '' diff --git a/core/src/main/python/wlsdeploy/json/json_translator.py b/core/src/main/python/wlsdeploy/json/json_translator.py index e3e95f1a1..cee30dbf9 100644 --- a/core/src/main/python/wlsdeploy/json/json_translator.py +++ b/core/src/main/python/wlsdeploy/json/json_translator.py @@ -4,6 +4,8 @@ This model provider translation classes that convert between JSON and Python Dictionaries. """ +import types + import java.io.FileNotFoundException as JFileNotFoundException import java.io.FileOutputStream as JFileOutputStream import java.io.IOException as JIOException @@ -202,14 +204,15 @@ def _format_json_value(value): """ import java.lang.StringBuilder as StringBuilder builder = StringBuilder() - if type(value) == bool or (type(value) == str and (value == 'true' or value == 'false')): + if type(value) == bool or (isinstance(value, types.StringTypes) and (value == 'true' or value == 'false')): builder.append(JBoolean.toString(value)) - elif type(value) == str: - builder.append('"').append(_quote_embedded_quotes(value)).append('"') + elif isinstance(value, types.StringTypes): + builder.append('"').append(_quote_embedded_quotes(value.strip())).append('"') else: builder.append(value) return builder.toString() + def _quote_embedded_quotes(text): """ Quote all embedded double quotes in a string with a backslash. @@ -217,6 +220,6 @@ def _quote_embedded_quotes(text): :return: the quotes result """ result = text - if type(text) is str and '"' in text: + if isinstance(text, types.StringTypes) and '"' in text: result = text.replace('"', '\\"') return result diff --git a/core/src/main/python/wlsdeploy/tool/create/domain_creator.py b/core/src/main/python/wlsdeploy/tool/create/domain_creator.py index 87b37e631..75ac44539 100644 --- a/core/src/main/python/wlsdeploy/tool/create/domain_creator.py +++ b/core/src/main/python/wlsdeploy/tool/create/domain_creator.py @@ -2,7 +2,7 @@ Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. """ -import javaos as os +import os import weblogic.security.internal.SerializedSystemIni as SerializedSystemIni import weblogic.security.internal.encryption.ClearOrEncryptedService as ClearOrEncryptedService from java.io import FileOutputStream diff --git a/core/src/main/python/wlsdeploy/tool/create/domain_typedef.py b/core/src/main/python/wlsdeploy/tool/create/domain_typedef.py index f6c4f297b..c2c812dfa 100644 --- a/core/src/main/python/wlsdeploy/tool/create/domain_typedef.py +++ b/core/src/main/python/wlsdeploy/tool/create/domain_typedef.py @@ -2,7 +2,7 @@ Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. """ -import javaos as os +import os import re from java.lang import IllegalArgumentException @@ -18,6 +18,7 @@ CREATE_DOMAIN = 'createDomain' UPDATE_DOMAIN = 'updateDomain' +NOT_SUPPORTED = 'NOT_SUPPORTED' class DomainTypedef(object): @@ -370,6 +371,7 @@ def __get_version_typedef(self): raise ex self._version_typedef_name = self.__match_version_typedef(self._domain_typedefs_dict['versions']) + if self._version_typedef_name in self._domain_typedefs_dict['definitions']: result = self._domain_typedefs_dict['definitions'][self._version_typedef_name] else: @@ -417,6 +419,10 @@ def __match_version_typedef(self, versions_dict): self._domain_typedef_filename, wls_version) self._logger.throwing(ex, class_name=self.__class_name, method_name=_method_name) raise ex + if result == NOT_SUPPORTED: + ex = exception_helper.create_create_exception('WLSDPLY-12313', self._domain_type, wls_version) + self._logger.throwing(ex, class_name=self.__class_name, method_name=_method_name) + raise ex self._logger.exiting(self.__class_name, _method_name, result) return result diff --git a/core/src/main/python/wlsdeploy/tool/deploy/applications_deployer.py b/core/src/main/python/wlsdeploy/tool/deploy/applications_deployer.py index f05a20e8c..6351a9005 100644 --- a/core/src/main/python/wlsdeploy/tool/deploy/applications_deployer.py +++ b/core/src/main/python/wlsdeploy/tool/deploy/applications_deployer.py @@ -3,7 +3,7 @@ Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. """ import copy -import javaos as os +import os from java.io import ByteArrayOutputStream from java.io import File from java.io import FileNotFoundException diff --git a/core/src/main/python/wlsdeploy/tool/deploy/deployer.py b/core/src/main/python/wlsdeploy/tool/deploy/deployer.py index 1377674ba..7a2da3959 100644 --- a/core/src/main/python/wlsdeploy/tool/deploy/deployer.py +++ b/core/src/main/python/wlsdeploy/tool/deploy/deployer.py @@ -2,7 +2,7 @@ Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. """ -import javaos as os +import os from array import array from java.lang import Class diff --git a/core/src/main/python/wlsdeploy/tool/discover/custom_folder_helper.py b/core/src/main/python/wlsdeploy/tool/discover/custom_folder_helper.py index 053222c38..fa40d64e4 100644 --- a/core/src/main/python/wlsdeploy/tool/discover/custom_folder_helper.py +++ b/core/src/main/python/wlsdeploy/tool/discover/custom_folder_helper.py @@ -337,18 +337,18 @@ def equal_jarrays(array1, array2): return False -def security_provider_interface_name(mbean_interface): +def security_provider_interface_name(mbean_interface_name): """ Return the name that is used to look up the custom Security Provider MBeanInfo. This is too tightly coupled to be in this class. This needs something more to differentiate Security Provider Interface which is formatted differently from other custom MBean Interface names. - :param mbean_interface: interface for the MBean - :return: massaged name specific to the Scurity Provider + :param mbean_interface_name: interface for the MBean + :return: provider class name returned from the massaged MBean name """ - result = mbean_interface - idx = mbean_interface.rfind('MBean') + result = mbean_interface_name + idx = mbean_interface_name.rfind('MBean') if idx > 0: result = result[:idx] return result @@ -422,7 +422,7 @@ def is_empty(value): :return: True if the attribute does not contain a value """ return value is None or (type(value) in [list, dict] and len(value) == 0) or \ - ((type(value) == str or isinstance(value, String)) and + ((isinstance(value, basestring) or isinstance(value, String)) and (len(value) == 0 or value == '[]' or value == 'null' or value == 'None')) diff --git a/core/src/main/python/wlsdeploy/tool/discover/discoverer.py b/core/src/main/python/wlsdeploy/tool/discover/discoverer.py index 06cf652f4..a8f1dc872 100644 --- a/core/src/main/python/wlsdeploy/tool/discover/discoverer.py +++ b/core/src/main/python/wlsdeploy/tool/discover/discoverer.py @@ -2,7 +2,7 @@ Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. """ -import javaos as os +import os from oracle.weblogic.deploy.aliases import AliasException from oracle.weblogic.deploy.discover import DiscoverException @@ -612,7 +612,7 @@ def _find_mbean_interface(self, location, interfaces): _method_name = '_find_mbean_interface' mbean_name = None for interface in interfaces: - interface_name = str(interface) + interface_name = str(interface.getTypeName()) if 'MBean' in interface_name: _logger.finer('WLSDPLY-06126', interface_name, self._alias_helper.get_model_folder_path(location), class_name=_class_name, method_name=_method_name) diff --git a/core/src/main/python/wlsdeploy/tool/discover/domain_info_discoverer.py b/core/src/main/python/wlsdeploy/tool/discover/domain_info_discoverer.py index c7b0a29e1..6a779d619 100644 --- a/core/src/main/python/wlsdeploy/tool/discover/domain_info_discoverer.py +++ b/core/src/main/python/wlsdeploy/tool/discover/domain_info_discoverer.py @@ -2,7 +2,7 @@ Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. """ -import javaos as os +import os from java.io import File diff --git a/core/src/main/python/wlsdeploy/tool/util/filter_helper.py b/core/src/main/python/wlsdeploy/tool/util/filter_helper.py index 7ecad49e2..dd20beba3 100644 --- a/core/src/main/python/wlsdeploy/tool/util/filter_helper.py +++ b/core/src/main/python/wlsdeploy/tool/util/filter_helper.py @@ -3,7 +3,7 @@ Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. """ import imp -import javaos as os +import os import sys from wlsdeploy.logging.platform_logger import PlatformLogger diff --git a/core/src/main/python/wlsdeploy/tool/util/mbean_utils.py b/core/src/main/python/wlsdeploy/tool/util/mbean_utils.py index c2538a5b0..3ea30c6d4 100644 --- a/core/src/main/python/wlsdeploy/tool/util/mbean_utils.py +++ b/core/src/main/python/wlsdeploy/tool/util/mbean_utils.py @@ -340,16 +340,17 @@ class MBeanAttributes(object): specific information. """ - __interface_matcher = re.compile('Bean$') + __interface_matcher = re.compile('Bean') - def __init__(self, model_context, alias_helper, exception_type, location, mbean_interface_name): + def __init__(self, model_context, alias_helper, exception_type, location): self.__model_context = model_context self.__exception_type = exception_type self.__location = location self.__alias_helper = alias_helper - self.__mbean_interface = mbean_interface_name self.__wlst_helper = WlstHelper(_logger, exception_type) + self.__mbean_interface_name = None self.__mbean_instance = None + self.__mbean_interface = None self.__mbean_name = '' def mbean_string(self): @@ -371,10 +372,11 @@ def get_mbean_interface_name(self): Return the full name of the MBean interface class. :return: Interface name """ - return self._get_mbean_interface() + self._get_mbean_interface() + return self.__mbean_interface_name - def _get_mbean_instance(self): - _method_name = '_get_mbean_instance' + def get_mbean_instance(self): + _method_name = 'get_mbean_instance' if self.__mbean_instance is None: attribute_path = self.__alias_helper.get_wlst_attributes_path(self.__location) self.__mbean_instance = self.__wlst_helper.get_mbean(attribute_path) @@ -392,17 +394,18 @@ def _get_mbean_interface(self): if re.search(self.__interface_matcher, str(interface)) is not None] if len(interfaces) == 0: ex = exception_helper.create_exception(self._get_exception_type(), 'WLSDPLY-01777', - self._get_mbean_instance()) + str(self._get_mbean_interfaces()), self.get_mbean_instance()) _logger.throwing(ex, class_name=self.__class__.__name__, method_name=_method_name) raise ex else: if len(interfaces) > 1: - _logger.fine('WLSDPLY-01770', interfaces, self._get_mbean_instance(), + _logger.fine('WLSDPLY-01770', interfaces, self.get_mbean_instance(), class_name=self.__class__.__name__, method_name=_method_name) - interface = interfaces[0] - self.__mbean_name = interface.getSimpleName() - self.__mbean_interface = str(interface) - _logger.exiting(class_name=self.__class__.__name__, method_name=_method_name, result=self.__mbean_interface) + self.__mbean_interface = interfaces[0] + self.__mbean_name = str(self.__mbean_interface.getSimpleName()) + self.__mbean_interface_name = str(self.__mbean_interface.getTypeName()) + _logger.exiting(class_name=self.__class__.__name__, method_name=_method_name, + result=self.__mbean_interface_name) return self.__mbean_interface @@ -421,7 +424,7 @@ def _get_exception_type(self): def __get_mbean_class(self): _method_name = '__get_mbean_class' mbean_class = None - mbean_instance = self._get_mbean_instance() + mbean_instance = self.get_mbean_instance() try: getter = getattr(mbean_instance, 'getClass') mbean_class = getter() @@ -438,7 +441,7 @@ def _get_from_bean_proxy(self, getter): success = False value = None try: - get_method = getattr(self._get_mbean_instance(), getter) + get_method = getattr(self.get_mbean_instance(), getter) if get_method is not None: value = get_method() _logger.finest('WLSDPLY-01784', getter, self._get_mbean_name(), @@ -466,8 +469,8 @@ class InterfaceAttributes(MBeanAttributes): attribute methods on the WLST CMO instance. """ - def __init__(self, model_context, alias_helper, exception_type, location, mbean_interface_name=None): - MBeanAttributes.__init__(self, model_context, alias_helper, exception_type, location, mbean_interface_name) + def __init__(self, model_context, alias_helper, exception_type, location): + MBeanAttributes.__init__(self, model_context, alias_helper, exception_type, location) self.__interface_methods_list = None self.__interface_method_names_list = None @@ -718,8 +721,8 @@ class MBeanInfoAttributes(MBeanAttributes): __class_name = 'MBeanInfoAttributes' - def __init__(self, model_context, alias_helper, exception_type, location, mbean_interface_name=None): - MBeanAttributes.__init__(self, model_context, alias_helper, exception_type, location, mbean_interface_name) + def __init__(self, model_context, alias_helper, exception_type, location): + MBeanAttributes.__init__(self, model_context, alias_helper, exception_type, location) self.__weblogic_helper = WebLogicHelper(_logger) self.__mbean_info_descriptors = None @@ -886,10 +889,10 @@ def __get_mbean_info_map(self): def __get_mbean_descriptors(self): _method_name = '__get_mbean_descriptors' if self.__mbean_info_descriptors is None: - mbean_info = self.__weblogic_helper.get_bean_info_for_interface(self._get_mbean_interface()) + mbean_info = self.__weblogic_helper.get_bean_info_for_interface(self.get_mbean_interface_name()) if mbean_info is None: ex = exception_helper.create_exception(self._get_exception_type(), 'WLSDPLY-01774', - self._get_mbean_interface(), self.mbean_string()) + self.get_mbean_interface_name(), self.mbean_string()) _logger.throwing(ex, class_name=self.__class__.__name__, method_name=_method_name) raise ex self.__mbean_info_descriptors = mbean_info.getPropertyDescriptors() diff --git a/core/src/main/python/wlsdeploy/tool/util/variable_injector.py b/core/src/main/python/wlsdeploy/tool/util/variable_injector.py index abc97b500..796e8244a 100644 --- a/core/src/main/python/wlsdeploy/tool/util/variable_injector.py +++ b/core/src/main/python/wlsdeploy/tool/util/variable_injector.py @@ -728,7 +728,7 @@ def _compile_pattern(pattern): def _already_property(check_string): - return type(check_string) == str and check_string.startswith('@@PROP:') + return isinstance(check_string, basestring) and check_string.startswith('@@PROP:') def _format_as_property(prop_name): diff --git a/core/src/main/python/wlsdeploy/tool/validate/validation_utils.py b/core/src/main/python/wlsdeploy/tool/validate/validation_utils.py index 21d6d60a7..3f5daa6a0 100644 --- a/core/src/main/python/wlsdeploy/tool/validate/validation_utils.py +++ b/core/src/main/python/wlsdeploy/tool/validate/validation_utils.py @@ -23,7 +23,13 @@ def extract_path_tokens(tokenized_value): :param tokenized_value: :return: """ - tokens = re.findall(_path_token_pattern, str(tokenized_value)) + path_pattern = _path_token_pattern + path_value = tokenized_value + if tokenized_value.isunicode(): + path_pattern = unicode(_path_token_pattern) + elif not isinstance(tokenized_value, basestring): + path_value = str(tokenized_value) + tokens = re.findall(path_pattern, path_value) if tokens is None: # tokenized_value didn't contain any variable expressions, so # return an empty list @@ -55,6 +61,7 @@ def get_python_data_type(value): """ data_types_map = { types.StringType: 'string', + "": 'unicode', types.IntType: 'integer', types.LongType: 'long', types.FloatType: 'float', @@ -64,9 +71,10 @@ def get_python_data_type(value): types.ListType: 'list' } data_type = type(value) - if data_type in data_types_map: rtnval = data_types_map[data_type] + elif str(data_type) in data_types_map: + rtnval = data_types_map[str(data_type)] else: rtnval = data_type @@ -131,23 +139,23 @@ def is_compatible_data_type(expected_data_type, actual_data_type): """ retval = False if expected_data_type == 'string': - retval = (actual_data_type in ["", ""]) + retval = (actual_data_type in ["", "", ""]) elif expected_data_type == 'integer': - retval = (actual_data_type in ["", "", ""]) + retval = (actual_data_type in ["", "", "", ""]) elif expected_data_type == 'long': - retval = (actual_data_type in ["", "", ""]) + retval = (actual_data_type in ["", "", "", ""]) elif expected_data_type in ['boolean', 'java.lang.Boolean']: - retval = (actual_data_type in ["", "", ""]) + retval = (actual_data_type in ["", "", "", ""]) elif expected_data_type in ['float', 'double']: - retval = (actual_data_type in ["", ""]) + retval = (actual_data_type in ["", "", ""]) elif expected_data_type == 'properties' or expected_data_type == 'dict': retval = (actual_data_type in ["", "", ""]) elif 'list' in expected_data_type: - retval = (actual_data_type in ["", ""]) + retval = (actual_data_type in ["", "", ""]) elif expected_data_type in ['password', 'credential', 'jarray']: retval = (actual_data_type in [""]) elif 'delimited_' in expected_data_type: - retval = (actual_data_type in ["", ""]) + retval = (actual_data_type in ["", "", ""]) return retval diff --git a/core/src/main/python/wlsdeploy/tool/validate/validator.py b/core/src/main/python/wlsdeploy/tool/validate/validator.py index 52019d187..85025612a 100644 --- a/core/src/main/python/wlsdeploy/tool/validate/validator.py +++ b/core/src/main/python/wlsdeploy/tool/validate/validator.py @@ -827,7 +827,7 @@ def __validate_path_tokens_attribute(self, attribute_name, attribute_value, mode self._logger.finest('value_data_type={0}', value_data_type, class_name=_class_name, method_name=_method_name) - valid_valus_data_types = ['list', 'string'] + valid_valus_data_types = ['list', 'string', 'unicode'] if value_data_type not in valid_valus_data_types: self._logger.severe('WLSDPLY-05023', attribute_name, model_folder_path, value_data_type, class_name=_class_name, method_name=_method_name) @@ -837,7 +837,7 @@ def __validate_path_tokens_attribute(self, attribute_name, attribute_value, mode if value_data_type == 'string' and model_constants.MODEL_LIST_DELIMITER in attribute_value: attr_values = attribute_value.split(model_constants.MODEL_LIST_DELIMITER) - elif value_data_type == 'string': + elif value_data_type in ['string', 'unicode']: attr_values.append(attribute_value) else: @@ -909,7 +909,7 @@ def __validate_server_group_targeting_limits(self, attribute_name, attribute_val if '${' in key: self._report_unsupported_variable_usage(key, model_folder_path) - if type(value) is str and MODEL_LIST_DELIMITER in value: + if isinstance(value, basestring) and MODEL_LIST_DELIMITER in value: value = value.split(MODEL_LIST_DELIMITER) if type(value) is list: diff --git a/core/src/main/python/wlsdeploy/util/model_context.py b/core/src/main/python/wlsdeploy/util/model_context.py index e1cb5bf0d..41ab3ccd0 100644 --- a/core/src/main/python/wlsdeploy/util/model_context.py +++ b/core/src/main/python/wlsdeploy/util/model_context.py @@ -2,7 +2,7 @@ Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. """ -import javaos as os +import os import tempfile from wlsdeploy.aliases.wlst_modes import WlstModes diff --git a/core/src/main/python/wlsdeploy/util/path_utils.py b/core/src/main/python/wlsdeploy/util/path_utils.py index 4b7f9a85f..ba0ae753f 100644 --- a/core/src/main/python/wlsdeploy/util/path_utils.py +++ b/core/src/main/python/wlsdeploy/util/path_utils.py @@ -2,7 +2,7 @@ Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. """ -import javaos as os +import os import re import java.io.File as JFile diff --git a/core/src/main/python/wlsdeploy/util/variables.py b/core/src/main/python/wlsdeploy/util/variables.py index 01939bdaf..eac1a66a11 100644 --- a/core/src/main/python/wlsdeploy/util/variables.py +++ b/core/src/main/python/wlsdeploy/util/variables.py @@ -152,7 +152,7 @@ def _process_node(nodes, variables, model_context): :param model_context: used to resolve variables in file paths """ # iterate over copy to avoid concurrent change for add/delete - if type(nodes) is OrderedDict: + if isinstance(nodes, OrderedDict): nodes_iterator = OrderedDict(nodes) else: nodes_iterator = dict(nodes) diff --git a/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties b/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties index 22d58ef63..37b3e7567 100644 --- a/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties +++ b/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties @@ -1151,6 +1151,7 @@ WLSDPLY-12309=Domain type {0} type definition in file {1} did not contain a vers WLSDPLY-12310=Version {0} returned from the domain home WLSDPLY-12311=Targeting type "{0}" in type definition file {1} is not allowed for WebLogic version {2} WLSDPLY-12312=Targeting type "{0}" in type definition file {1} is not valid +WLSDPLY-12313=Domain type {0} is not supported for WebLogic version {1} # create.py WLSDPLY-12400={0} got the JAVA_HOME {1} from the environment variable but it was not a valid location: {2} diff --git a/core/src/main/typedefs/JRF.json b/core/src/main/typedefs/JRF.json index faabea778..67ca07933 100644 --- a/core/src/main/typedefs/JRF.json +++ b/core/src/main/typedefs/JRF.json @@ -9,7 +9,8 @@ "12.1.3": "JRF_1213", "12.2.1": "JRF_12CR2", "12.2.1.3": "JRF_12CR2", - "12.2.1.4": "JRF_12CR2" + "12.2.1.4": "JRF_12CR2", + "14.1.1": "NOT_SUPPORTED" }, "definitions": { "JRF_11G" : { diff --git a/core/src/main/typedefs/RestrictedJRF.json b/core/src/main/typedefs/RestrictedJRF.json index 2eeede477..01145b992 100644 --- a/core/src/main/typedefs/RestrictedJRF.json +++ b/core/src/main/typedefs/RestrictedJRF.json @@ -6,7 +6,8 @@ "versions": { "12.2.1": "RJRF_12CR2", "12.2.1.3": "RJRF_12CR2", - "12.2.1.4": "RJRF_12CR2" + "12.2.1.4": "RJRF_12CR2", + "14.1.1": "NOT_SUPPORTED" }, "definitions": { "RJRF_12CR2": { diff --git a/core/src/main/typedefs/WLS.json b/core/src/main/typedefs/WLS.json index f1ba7c3ed..473261583 100644 --- a/core/src/main/typedefs/WLS.json +++ b/core/src/main/typedefs/WLS.json @@ -10,7 +10,8 @@ "12.1.3": "WLS_12CR1", "12.2.1": "WLS_12CR2", "12.2.1.3": "WLS_12CR2", - "12.2.1.4": "WLS_12CR2" + "12.2.1.4": "WLS_12CR2", + "14.1.1": "WLS_14" }, "definitions": { "WLS_11G": { @@ -33,6 +34,13 @@ "customExtensionTemplates": [ ], "serverGroupsToTarget": [ ], "rcuSchemas": [ ] + }, + "WLS_14": { + "baseTemplate": "Basic WebLogic Server Domain", + "extensionTemplates": [ ], + "customExtensionTemplates": [ ], + "serverGroupsToTarget": [ ], + "rcuSchemas": [ ] } } } diff --git a/core/src/test/python/translator_test.py b/core/src/test/python/translator_test.py index cab30f822..54f0912ab 100644 --- a/core/src/test/python/translator_test.py +++ b/core/src/test/python/translator_test.py @@ -2,7 +2,7 @@ Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. """ -import javaos as os +import os import unittest from wlsdeploy.util.model_translator import FileToPython, PythonToFile diff --git a/core/src/test/python/variable_injector_test.py b/core/src/test/python/variable_injector_test.py index a7a8f5362..6479176c5 100644 --- a/core/src/test/python/variable_injector_test.py +++ b/core/src/test/python/variable_injector_test.py @@ -278,7 +278,6 @@ def testReplaceVariableValueAttribute(self): 'JNDIProperty[java.naming.security.principal].Value'][ variable_injector.VARIABLE_VALUE] = 'k8s' actual = self._helper.inject_variables(replacement_dict) - print actual self._compare_to_expected_dictionary(expected, actual) def testReplaceVariableValueSegmentInString(self): diff --git a/installer/src/main/bin/createDomain.cmd b/installer/src/main/bin/createDomain.cmd index e500795ed..8af4e64aa 100644 --- a/installer/src/main/bin/createDomain.cmd +++ b/installer/src/main/bin/createDomain.cmd @@ -164,15 +164,22 @@ IF "%DOMAIN_TYPE%"=="" ( @rem FOR /F tokens^=2-5^ delims^=.-_^" %%j IN ('%JAVA_EXE% -fullversion 2^>^&1') DO ( SET "JVM_FULL_VERSION=%%j.%%k.%%l_%%m" - SET "JVM_VERSION=%%k" + SET "JVM_VERSION_PART_ONE=%%j" + SET "JVM_VERSION_PART_TWO=%%k" ) -IF %JVM_VERSION% LSS %MIN_JDK_VERSION% ( - IF %JVM_VERSION% LSS 7 ( - ECHO You are using an unsupported JDK version %JVM_FULL_VERSION% >&2 - ) ELSE ( - ECHO JDK version 1.8 or higher is required when using encryption >&2 - ) +SET JVM_SUPPORTED=1 +IF %JVM_VERSION_PART_ONE% LEQ 1 ( + IF %JVM_VERSION_PART_TWO% LSS %MIN_JDK_VERSION% ( + SET JVM_SUPPORTED=0 + IF %JVM_VERSION_PART_TWO% LSS 7 ( + ECHO You are using an unsupported JDK version %JVM_FULL_VERSION% >&2 + ) ELSE ( + ECHO JDK version 1.8 or higher is required when using encryption >&2 + ) + ) +) +IF %JVM_SUPPORTED% NEQ 1 ( SET RETURN_CODE=2 GOTO exit_script ) ELSE ( diff --git a/installer/src/main/bin/createDomain.sh b/installer/src/main/bin/createDomain.sh index 31cc7331f..22e8e240a 100644 --- a/installer/src/main/bin/createDomain.sh +++ b/installer/src/main/bin/createDomain.sh @@ -213,7 +213,12 @@ fi # Validate the JVM version based on whether or not the user asked us to use encryption # JVM_FULL_VERSION=`${JAVA_EXE} -fullversion 2>&1 | awk -F"\"" '{ print $2 }'` -JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` +# set JVM version to the major version, unless equal to 1, like 1.8.0, then use the minor version +JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $1 }'` + +if [ "${JVM_VERSION}" -eq "1" ]; then + JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` +fi if [ ${JVM_VERSION} -lt ${MIN_JDK_VERSION} ]; then if [ ${JVM_VERSION} -lt 7 ]; then diff --git a/installer/src/main/bin/deployApps.cmd b/installer/src/main/bin/deployApps.cmd index bbded0921..5a694cbf3 100644 --- a/installer/src/main/bin/deployApps.cmd +++ b/installer/src/main/bin/deployApps.cmd @@ -161,15 +161,22 @@ IF "%DOMAIN_TYPE%"=="" ( @rem FOR /F tokens^=2-5^ delims^=.-_^" %%j IN ('%JAVA_EXE% -fullversion 2^>^&1') DO ( SET "JVM_FULL_VERSION=%%j.%%k.%%l_%%m" - SET "JVM_VERSION=%%k" + SET "JVM_VERSION_PART_ONE=%%j" + SET "JVM_VERSION_PART_TWO=%%k" ) -IF %JVM_VERSION% LSS %MIN_JDK_VERSION% ( - IF %JVM_VERSION% LSS 7 ( - ECHO You are using an unsupported JDK version %JVM_FULL_VERSION% >&2 - ) ELSE ( - ECHO JDK version 1.8 or higher is required when using encryption >&2 - ) +SET JVM_SUPPORTED=1 +IF %JVM_VERSION_PART_ONE% LEQ 1 ( + IF %JVM_VERSION_PART_TWO% LSS %MIN_JDK_VERSION% ( + SET JVM_SUPPORTED=0 + IF %JVM_VERSION_PART_TWO% LSS 7 ( + ECHO You are using an unsupported JDK version %JVM_FULL_VERSION% >&2 + ) ELSE ( + ECHO JDK version 1.8 or higher is required when using encryption >&2 + ) + ) +) +IF %JVM_SUPPORTED% NEQ 1 ( SET RETURN_CODE=2 GOTO exit_script ) ELSE ( diff --git a/installer/src/main/bin/deployApps.sh b/installer/src/main/bin/deployApps.sh index be67a2623..3c03909a1 100644 --- a/installer/src/main/bin/deployApps.sh +++ b/installer/src/main/bin/deployApps.sh @@ -193,7 +193,12 @@ fi # Validate the JVM version based on whether or not the user asked us to use encryption # JVM_FULL_VERSION=`${JAVA_EXE} -fullversion 2>&1 | awk -F"\"" '{ print $2 }'` -JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` +# set JVM version to the major version, unless equal to 1, like 1.8.0, then use the minor version +JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $1 }'` + +if [ "${JVM_VERSION}" -eq "1" ]; then + JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` +fi if [ ${JVM_VERSION} -lt ${MIN_JDK_VERSION} ]; then if [ ${JVM_VERSION} -lt 7 ]; then diff --git a/installer/src/main/bin/discoverDomain.cmd b/installer/src/main/bin/discoverDomain.cmd index c14ef76e8..c4e8f13d4 100644 --- a/installer/src/main/bin/discoverDomain.cmd +++ b/installer/src/main/bin/discoverDomain.cmd @@ -74,7 +74,7 @@ IF %WLSDEPLOY_HOME:~-1%==\ SET WLSDEPLOY_HOME=%WLSDEPLOY_HOME:~0,-1% @rem JDK 7 or higher JVM (and that it isn't OpenJDK). @rem IF NOT DEFINED JAVA_HOME ( - ECHO Please set the JAVA_HOME environment variable to point to a Java 7 installation >&2 + ECHO Please set the JAVA_HOME environment variable to point to a Java 7 or later installation >&2 SET RETURN_CODE=2 GOTO exit_script ) ELSE ( @@ -105,10 +105,17 @@ FOR /F %%i IN ('%JAVA_EXE% -version 2^>^&1') DO ( FOR /F tokens^=2-5^ delims^=.-_^" %%j IN ('%JAVA_EXE% -fullversion 2^>^&1') DO ( SET "JVM_FULL_VERSION=%%j.%%k.%%l_%%m" - SET "JVM_VERSION=%%k" + SET "JVM_VERSION_PART_ONE=%%j" + SET "JVM_VERSION_PART_TWO=%%k" ) -IF %JVM_VERSION% LSS 7 ( +SET JVM_SUPPORTED=1 +IF %JVM_VERSION_PART_ONE% LEQ 1 ( + IF %JVM_VERSION_PART_TWO% LSS 7 ( + SET JVM_SUPPORTED=0 + ) +) +IF %JVM_SUPPORTED% NEQ 1 ( ECHO You are using an unsupported JDK version %JVM_FULL_VERSION% >&2 SET RETURN_CODE=2 GOTO exit_script diff --git a/installer/src/main/bin/discoverDomain.sh b/installer/src/main/bin/discoverDomain.sh index afbc0c7fe..928070cde 100644 --- a/installer/src/main/bin/discoverDomain.sh +++ b/installer/src/main/bin/discoverDomain.sh @@ -124,7 +124,13 @@ case "${JVM_OUTPUT}" in esac JVM_FULL_VERSION=`${JAVA_EXE} -fullversion 2>&1 | awk -F"\"" '{ print $2 }'` -JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` +# set JVM version to the major version, unless equal to 1, like 1.8.0, then use the minor version +JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $1 }'` + +if [ "${JVM_VERSION}" -eq "1" ]; then + JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` + echo "set JVM version to minor " ${JVM_VERSION} +fi if [ ${JVM_VERSION} -lt 7 ]; then echo "You are using an unsupported JDK version ${JVM_FULL_VERSION}" >&2 diff --git a/installer/src/main/bin/encryptModel.cmd b/installer/src/main/bin/encryptModel.cmd index 578a8625b..d176ffea3 100644 --- a/installer/src/main/bin/encryptModel.cmd +++ b/installer/src/main/bin/encryptModel.cmd @@ -108,15 +108,22 @@ FOR /F %%i IN ('%JAVA_EXE% -version 2^>^&1') DO ( FOR /F tokens^=2-5^ delims^=.-_^" %%j IN ('%JAVA_EXE% -fullversion 2^>^&1') DO ( SET "JVM_FULL_VERSION=%%j.%%k.%%l_%%m" - SET "JVM_VERSION=%%k" + SET "JVM_VERSION_PART_ONE=%%j" + SET "JVM_VERSION_PART_TWO=%%k" ) -IF %JVM_VERSION% LSS 8 ( - IF %JVM_VERSION% LSS 7 ( - ECHO You are using an unsupported JDK version %JVM_FULL_VERSION% >&2 - ) ELSE ( - ECHO JDK version 1.8 or higher is required when using encryption >&2 - ) +SET JVM_SUPPORTED=1 +IF %JVM_VERSION_PART_ONE% LEQ 1 ( + IF %JVM_VERSION_PART_TWO% LSS %MIN_JDK_VERSION% ( + SET JVM_SUPPORTED=0 + IF %JVM_VERSION_PART_TWO% LSS 7 ( + ECHO You are using an unsupported JDK version %JVM_FULL_VERSION% >&2 + ) ELSE ( + ECHO JDK version 1.8 or higher is required when using encryption >&2 + ) + ) +) +IF %JVM_SUPPORTED% NEQ 1 ( SET RETURN_CODE=2 GOTO exit_script ) ELSE ( diff --git a/installer/src/main/bin/encryptModel.sh b/installer/src/main/bin/encryptModel.sh index 160efd37f..8d572533c 100644 --- a/installer/src/main/bin/encryptModel.sh +++ b/installer/src/main/bin/encryptModel.sh @@ -124,7 +124,12 @@ case "${JVM_OUTPUT}" in esac JVM_FULL_VERSION=`${JAVA_EXE} -fullversion 2>&1 | awk -F"\"" '{ print $2 }'` -JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` +# set JVM version to the major version, unless equal to 1, like 1.8.0, then use the minor version +JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $1 }'` + +if [ "${JVM_VERSION}" -eq "1" ]; then + JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` +fi if [ ${JVM_VERSION} -lt 8 ]; then if [ ${JVM_VERSION} -lt 7 ]; then diff --git a/installer/src/main/bin/injectVariables.cmd b/installer/src/main/bin/injectVariables.cmd index bf205ea44..f61ef2edd 100644 --- a/installer/src/main/bin/injectVariables.cmd +++ b/installer/src/main/bin/injectVariables.cmd @@ -107,10 +107,17 @@ FOR /F %%i IN ('%JAVA_EXE% -version 2^>^&1') DO ( FOR /F tokens^=2-5^ delims^=.-_^" %%j IN ('%JAVA_EXE% -fullversion 2^>^&1') DO ( SET "JVM_FULL_VERSION=%%j.%%k.%%l_%%m" - SET "JVM_VERSION=%%k" + SET "JVM_VERSION_PART_ONE=%%j" + SET "JVM_VERSION_PART_TWO=%%k" ) -IF %JVM_VERSION% LSS 7 ( +SET JVM_SUPPORTED=1 +IF %JVM_VERSION_PART_ONE% LEQ 1 ( + IF %JVM_VERSION_PART_TWO% LSS 7 ( + SET JVM_SUPPORTED=0 + ) +) +IF %JVM_SUPPORTED% NEQ 1 ( ECHO You are using an unsupported JDK version %JVM_FULL_VERSION% >&2 SET RETURN_CODE=2 GOTO exit_script diff --git a/installer/src/main/bin/injectVariables.sh b/installer/src/main/bin/injectVariables.sh index a12944326..e39ab54b9 100644 --- a/installer/src/main/bin/injectVariables.sh +++ b/installer/src/main/bin/injectVariables.sh @@ -136,7 +136,12 @@ case "${JVM_OUTPUT}" in esac JVM_FULL_VERSION=`${JAVA_EXE} -fullversion 2>&1 | awk -F"\"" '{ print $2 }'` -JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` +# set JVM version to the major version, unless equal to 1, like 1.8.0, then use the minor version +JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $1 }'` + +if [ "${JVM_VERSION}" -eq "1" ]; then + JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` +fi if [ ${JVM_VERSION} -lt 7 ]; then echo "You are using an unsupported JDK version ${JVM_FULL_VERSION}" >&2 diff --git a/installer/src/main/bin/updateDomain.cmd b/installer/src/main/bin/updateDomain.cmd index 1736a6951..b84a9888b 100644 --- a/installer/src/main/bin/updateDomain.cmd +++ b/installer/src/main/bin/updateDomain.cmd @@ -161,15 +161,22 @@ IF "%DOMAIN_TYPE%"=="" ( @rem FOR /F tokens^=2-5^ delims^=.-_^" %%j IN ('%JAVA_EXE% -fullversion 2^>^&1') DO ( SET "JVM_FULL_VERSION=%%j.%%k.%%l_%%m" - SET "JVM_VERSION=%%k" + SET "JVM_VERSION_PART_ONE=%%j" + SET "JVM_VERSION_PART_TWO=%%k" ) -IF %JVM_VERSION% LSS %MIN_JDK_VERSION% ( - IF %JVM_VERSION% LSS 7 ( - ECHO You are using an unsupported JDK version %JVM_FULL_VERSION% >&2 - ) ELSE ( - ECHO JDK version 1.8 or higher is required when using encryption >&2 - ) +SET JVM_SUPPORTED=1 +IF %JVM_VERSION_PART_ONE% LEQ 1 ( + IF %JVM_VERSION_PART_TWO% LSS %MIN_JDK_VERSION% ( + SET JVM_SUPPORTED=0 + IF %JVM_VERSION_PART_TWO% LSS 7 ( + ECHO You are using an unsupported JDK version %JVM_FULL_VERSION% >&2 + ) ELSE ( + ECHO JDK version 1.8 or higher is required when using encryption >&2 + ) + ) +) +IF %JVM_SUPPORTED% NEQ 1 ( SET RETURN_CODE=2 GOTO exit_script ) ELSE ( diff --git a/installer/src/main/bin/updateDomain.sh b/installer/src/main/bin/updateDomain.sh index a50665d07..dd9e14865 100644 --- a/installer/src/main/bin/updateDomain.sh +++ b/installer/src/main/bin/updateDomain.sh @@ -192,7 +192,12 @@ fi # Validate the JVM version based on whether or not the user asked us to use encryption # JVM_FULL_VERSION=`${JAVA_EXE} -fullversion 2>&1 | awk -F"\"" '{ print $2 }'` -JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` +# set JVM version to the major version, unless equal to 1, like 1.8.0, then use the minor version +JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $1 }'` + +if [ "${JVM_VERSION}" -eq "1" ]; then + JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` +fi if [ ${JVM_VERSION} -lt ${MIN_JDK_VERSION} ]; then if [ ${JVM_VERSION} -lt 7 ]; then diff --git a/installer/src/main/bin/validateModel.cmd b/installer/src/main/bin/validateModel.cmd index 76fe3d74d..f8c6e35cc 100644 --- a/installer/src/main/bin/validateModel.cmd +++ b/installer/src/main/bin/validateModel.cmd @@ -144,10 +144,17 @@ FOR /F %%i IN ('%JAVA_EXE% -version 2^>^&1') DO ( FOR /F tokens^=2-5^ delims^=.-_^" %%j IN ('%JAVA_EXE% -fullversion 2^>^&1') DO ( SET "JVM_FULL_VERSION=%%j.%%k.%%l_%%m" - SET "JVM_VERSION=%%k" + SET "JVM_VERSION_PART_ONE=%%j" + SET "JVM_VERSION_PART_TWO=%%k" ) -IF %JVM_VERSION% LSS 7 ( +SET JVM_SUPPORTED=1 +IF %JVM_VERSION_PART_ONE% LEQ 1 ( + IF %JVM_VERSION_PART_TWO% LSS 7 ( + SET JVM_SUPPORTED=0 + ) +) +IF %JVM_SUPPORTED% NEQ 1 ( ECHO You are using an unsupported JDK version %JVM_FULL_VERSION% >&2 SET RETURN_CODE=2 GOTO exit_script diff --git a/installer/src/main/bin/validateModel.sh b/installer/src/main/bin/validateModel.sh index ee78e5289..8107b42e5 100644 --- a/installer/src/main/bin/validateModel.sh +++ b/installer/src/main/bin/validateModel.sh @@ -153,7 +153,12 @@ case "${JVM_OUTPUT}" in esac JVM_FULL_VERSION=`${JAVA_EXE} -fullversion 2>&1 | awk -F"\"" '{ print $2 }'` -JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` +# set JVM version to the major version, unless equal to 1, like 1.8.0, then use the minor version +JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $1 }'` + +if [ "${JVM_VERSION}" -eq "1" ]; then + JVM_VERSION=`echo ${JVM_FULL_VERSION} | awk -F"." '{ print $2 }'` +fi if [ ${JVM_VERSION} -lt 7 ]; then echo "You are using an unsupported JDK version ${JVM_FULL_VERSION}" >&2