mirror of
https://github.com/apache/commons-lang.git
synced 2025-03-02 22:19:13 +00:00
Refactor magic string into an private constant
This commit is contained in:
parent
dfe80aaca3
commit
bd6a8c4227
@ -34,6 +34,11 @@
|
||||
*/
|
||||
public class SystemUtils {
|
||||
|
||||
/**
|
||||
* The regex to split version strings.
|
||||
*/
|
||||
private static final String VERSION_SPLIT_REGEX = "\\.";
|
||||
|
||||
/**
|
||||
* The prefix String for all Windows OS.
|
||||
*/
|
||||
@ -2148,8 +2153,8 @@ static boolean isOsVersionMatch(final String osVersion, final String osVersionPr
|
||||
}
|
||||
// Compare parts of the version string instead of using String.startsWith(String) because otherwise
|
||||
// osVersionPrefix 10.1 would also match osVersion 10.10
|
||||
final String[] versionPrefixParts = osVersionPrefix.split("\\.");
|
||||
final String[] versionParts = osVersion.split("\\.");
|
||||
final String[] versionPrefixParts = osVersionPrefix.split(VERSION_SPLIT_REGEX);
|
||||
final String[] versionParts = osVersion.split(VERSION_SPLIT_REGEX);
|
||||
for (int i = 0; i < Math.min(versionPrefixParts.length, versionParts.length); i++) {
|
||||
if (!versionPrefixParts[i].equals(versionParts[i])) {
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user