mirror of
https://github.com/apache/maven.git
synced 2025-02-08 02:59:22 +00:00
[MNG-8135] Profile activation based on OS properties is no longer case insensitive (#1561)
Backport of 0456c7c629d6fc872073268faeb77d2bde9a1b7d --- https://issues.apache.org/jira/browse/MNG-8135
This commit is contained in:
parent
2a43483a94
commit
9ee39630ad
@ -109,14 +109,14 @@ private boolean determineVersionMatch(String expectedVersion, String actualVersi
|
||||
reverse = true;
|
||||
test = test.substring(1);
|
||||
}
|
||||
result = actualVersion.equals(test);
|
||||
result = actualVersion.equalsIgnoreCase(test);
|
||||
}
|
||||
|
||||
return reverse != result;
|
||||
}
|
||||
|
||||
private boolean determineArchMatch(String expectedArch, String actualArch) {
|
||||
String test = expectedArch;
|
||||
String test = expectedArch.toLowerCase(Locale.ENGLISH);
|
||||
boolean reverse = false;
|
||||
|
||||
if (test.startsWith("!")) {
|
||||
@ -130,7 +130,7 @@ private boolean determineArchMatch(String expectedArch, String actualArch) {
|
||||
}
|
||||
|
||||
private boolean determineNameMatch(String expectedName, String actualName) {
|
||||
String test = expectedName;
|
||||
String test = expectedName.toLowerCase(Locale.ENGLISH);
|
||||
boolean reverse = false;
|
||||
|
||||
if (test.startsWith("!")) {
|
||||
@ -144,7 +144,7 @@ private boolean determineNameMatch(String expectedName, String actualName) {
|
||||
}
|
||||
|
||||
private boolean determineFamilyMatch(String family, String actualName) {
|
||||
String test = family;
|
||||
String test = family.toLowerCase(Locale.ENGLISH);
|
||||
boolean reverse = false;
|
||||
|
||||
if (test.startsWith("!")) {
|
||||
|
@ -141,4 +141,18 @@ public void testAllOsConditions() {
|
||||
assertActivation(false, profile, newContext(null, newProperties("windows", "99", "amd64")));
|
||||
assertActivation(true, profile, newContext(null, newProperties("windows", "99", "aarch64")));
|
||||
}
|
||||
|
||||
public void testCapitalOsName() {
|
||||
ActivationOS os = new ActivationOS();
|
||||
os.setFamily("Mac");
|
||||
os.setName("Mac OS X");
|
||||
os.setArch("aarch64");
|
||||
os.setVersion("14.5");
|
||||
Profile profile = newProfile(os);
|
||||
|
||||
assertActivation(false, profile, newContext(null, newProperties("linux", "6.5.0-1014-aws", "amd64")));
|
||||
assertActivation(false, profile, newContext(null, newProperties("windows", "1", "aarch64")));
|
||||
assertActivation(false, profile, newContext(null, newProperties("windows", "99", "amd64")));
|
||||
assertActivation(true, profile, newContext(null, newProperties("Mac OS X", "14.5", "aarch64")));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user