From 0456c7c629d6fc872073268faeb77d2bde9a1b7d Mon Sep 17 00:00:00 2001 From: liutang123 Date: Sat, 1 Jun 2024 23:56:00 +0800 Subject: [PATCH] Caplital OS name can not activate profile --- .../OperatingSystemProfileActivator.java | 8 ++++---- .../OperatingSystemProfileActivatorTest.java | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivator.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivator.java index 8afc691565..2553735cb4 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivator.java @@ -105,14 +105,14 @@ public class OperatingSystemProfileActivator implements ProfileActivator { 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("!")) { @@ -126,7 +126,7 @@ public class OperatingSystemProfileActivator implements ProfileActivator { } private boolean determineNameMatch(String expectedName, String actualName) { - String test = expectedName; + String test = expectedName.toLowerCase(Locale.ENGLISH); boolean reverse = false; if (test.startsWith("!")) { @@ -140,7 +140,7 @@ public class OperatingSystemProfileActivator implements ProfileActivator { } private boolean determineFamilyMatch(String family, String actualName) { - String test = family; + String test = family.toLowerCase(Locale.ENGLISH); boolean reverse = false; if (test.startsWith("!")) { diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivatorTest.java index 9fe3fb01dd..d2ab767d48 100644 --- a/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivatorTest.java +++ b/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivatorTest.java @@ -135,4 +135,18 @@ class OperatingSystemProfileActivatorTest extends AbstractProfileActivatorTest