diff --git a/java/code/src/com/redhat/rhn/common/security/acl/Acl.java b/java/code/src/com/redhat/rhn/common/security/acl/Acl.java index 86707082833e..01feaf81ea47 100644 --- a/java/code/src/com/redhat/rhn/common/security/acl/Acl.java +++ b/java/code/src/com/redhat/rhn/common/security/acl/Acl.java @@ -163,7 +163,7 @@ public class Acl { private static final String ACL_SPLIT_REGEX = "\\s*;\\s*"; /** RegEx to split expressions into multiple statements */ - private static final String EXPR_SPLIT_REGEX = "\\s+or\\s+"; + private static final String EXPR_SPLIT_REGEX = "\\s++or\\s++"; /** RegEx to parse statement to grab negation, function call, params */ private static final String STMT_PARSE_REGEX = "^(not +)?(.*)\\((.*)\\)$"; diff --git a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.java b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.java index 97d25fd95e4d..417623ddcf49 100644 --- a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.java +++ b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.java @@ -1020,11 +1020,7 @@ public String getBootloaderType() { return "grub"; } - String regEx = ".*--useLilo.*"; - Pattern pattern = Pattern.compile(regEx); - Matcher matcher = pattern.matcher(bootloaderCommand.getArguments()); - - if (matcher.matches()) { + if (bootloaderCommand.getArguments().contains("--useLilo")) { return "lilo"; } return "grub"; diff --git a/java/code/src/com/redhat/rhn/frontend/action/CSVDownloadAction.java b/java/code/src/com/redhat/rhn/frontend/action/CSVDownloadAction.java index e91c9ae93a63..54dfba50ada9 100644 --- a/java/code/src/com/redhat/rhn/frontend/action/CSVDownloadAction.java +++ b/java/code/src/com/redhat/rhn/frontend/action/CSVDownloadAction.java @@ -185,7 +185,7 @@ protected StreamInfo getStreamInfo(ActionMapping mapping, ActionForm form, // Read the CSV separator from user preferences User user = new RequestContext(request).getCurrentUser(); CSVWriter csvWriter = new CSVWriter(new StringWriter(), user.getCsvSeparator()); - String[] columns = exportColumns.split("\\s*,\\s*"); + String[] columns = exportColumns.split("\\s*+,\\s*+"); csvWriter.setColumns(Arrays.asList(columns)); String header = getHeaderText(request, session); diff --git a/java/code/src/com/redhat/rhn/frontend/action/kickstart/PowerManagementAction.java b/java/code/src/com/redhat/rhn/frontend/action/kickstart/PowerManagementAction.java index 63d83d1705db..86b6439fae9f 100644 --- a/java/code/src/com/redhat/rhn/frontend/action/kickstart/PowerManagementAction.java +++ b/java/code/src/com/redhat/rhn/frontend/action/kickstart/PowerManagementAction.java @@ -240,7 +240,7 @@ public static SortedMap setUpPowerTypes(HttpServletRequest reque SortedMap types = new TreeMap<>(); String typeString = ConfigDefaults.get().getCobblerPowerTypes(); if (typeString != null) { - List typeNames = Arrays.asList(typeString.split(" *, *")); + List typeNames = Arrays.asList(typeString.split(" *+, *+")); for (String typeName : typeNames) { types.put( LocalizationService.getInstance().getPlainText( diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/provisioning/powermanagement/PowerManagementHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/provisioning/powermanagement/PowerManagementHandler.java index 74264099de7a..5e728263ac67 100644 --- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/provisioning/powermanagement/PowerManagementHandler.java +++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/provisioning/powermanagement/PowerManagementHandler.java @@ -71,7 +71,7 @@ public class PowerManagementHandler extends BaseHandler { public List listTypes(User loggedInUser) { String typeString = ConfigDefaults.get().getCobblerPowerTypes(); if (typeString != null) { - return Arrays.asList(typeString.split(" *, *")); + return Arrays.asList(typeString.split(" *+, *+")); } return new ArrayList<>(); } diff --git a/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationValidation.java b/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationValidation.java index ed80327a5807..11f626695f95 100644 --- a/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationValidation.java +++ b/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationValidation.java @@ -80,7 +80,7 @@ public static ValidatorResult validateContent(String content, // One or more chars NOT parentheses$1, // followed by zero or one "( any-chars$3 ) $2", // followed by zero or one "= any-chars$5 $4" - String macroStr = "([^()]+)(\\((.*?)\\))?\\s*(=(.*))?"; + String macroStr = "([^()]++)(\\((.*?)\\))?\\s*+(=(.*+))?"; Pattern findMacro = Pattern.compile(findMacroStr, Pattern.MULTILINE + Pattern.DOTALL); diff --git a/java/code/src/com/suse/manager/reactor/utils/RhelUtils.java b/java/code/src/com/suse/manager/reactor/utils/RhelUtils.java index bd5cc339f216..b5a832439bf6 100644 --- a/java/code/src/com/suse/manager/reactor/utils/RhelUtils.java +++ b/java/code/src/com/suse/manager/reactor/utils/RhelUtils.java @@ -37,11 +37,11 @@ public class RhelUtils { private RhelUtils() { } private static final Pattern RHEL_RELEASE_MATCHER = - Pattern.compile("(.+)\\srelease\\s([\\d.]+)\\s*\\((.+)\\).*", Pattern.DOTALL); + Pattern.compile("(.+)\\srelease\\s([\\d.]+)\\s*+\\(([^)]++)\\).*+", Pattern.DOTALL); private static final Pattern ORACLE_RELEASE_MATCHER = Pattern.compile("(.+)\\srelease\\s([\\d.]+).*", Pattern.DOTALL); private static final Pattern ALIBABA_RELEASE_MATCHER = - Pattern.compile("(.+)\\srelease\\s([\\d.]+)\\s*LTS\\s*\\((.+)\\).*", Pattern.DOTALL); + Pattern.compile("(.+)\\srelease\\s([\\d.]+)\\s*+LTS\\s*+\\(([^)]++)\\).*+", Pattern.DOTALL); /** * Information about RHEL based OSes. diff --git a/java/code/src/com/suse/manager/webui/services/SaltServerActionService.java b/java/code/src/com/suse/manager/webui/services/SaltServerActionService.java index 450338ab38db..78d52ba87108 100644 --- a/java/code/src/com/suse/manager/webui/services/SaltServerActionService.java +++ b/java/code/src/com/suse/manager/webui/services/SaltServerActionService.java @@ -1712,10 +1712,10 @@ private Map, List> scapXccdfEvalAction( if (tailoringIdMatcher.find()) { pillar.put("tailoring_id", tailoringIdMatcher.group(1)); } - if (scapActionDetails.getParametersContents().matches(".*--fetch-remote-resources.*")) { + if (scapActionDetails.getParametersContents().contains("--fetch-remote-resources")) { pillar.put("fetch_remote_resources", true); } - if (scapActionDetails.getParametersContents().matches(".*--remediate.*")) { + if (scapActionDetails.getParametersContents().contains("--remediate")) { pillar.put("remediate", true); }