This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-wrapper.git
The following commit(s) were added to refs/heads/master by this push:
new 6e24460 [MWRAPPER-111] Trim whitespace when reading from properties
file
6e24460 is described below
commit 6e24460ebcb4eec73ed6a73bba161355d436edc0
Author: Moritz Halbritter <[email protected]>
AuthorDate: Wed Oct 30 13:57:08 2024 +0100
[MWRAPPER-111] Trim whitespace when reading from properties file
---
maven-wrapper-distribution/src/resources/mvnw | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/maven-wrapper-distribution/src/resources/mvnw
b/maven-wrapper-distribution/src/resources/mvnw
index 5272759..de92566 100644
--- a/maven-wrapper-distribution/src/resources/mvnw
+++ b/maven-wrapper-distribution/src/resources/mvnw
@@ -201,6 +201,14 @@ MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
export MAVEN_PROJECTBASEDIR
log "$MAVEN_PROJECTBASEDIR"
+trim() {
+ # MWRAPPER-139:
+ # Trims trailing and leading whitespace, carriage returns, tabs, and
linefeeds.
+ # Needed for removing poorly interpreted newline sequences when running in
more
+ # exotic environments such as mingw bash on Windows.
+ printf "%s" "${1}" | tr -d '[:space:]'
+}
+
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from
Maven-central
# This allows using the maven wrapper in projects that prohibit checking in
binary data.
@@ -217,10 +225,8 @@ else
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/@@project.version@@/maven-wrapper-@@project.version@@.jar"
fi
while IFS="=" read -r key value; do
- # Remove '\r' from value to allow usage on windows as IFS does not
consider '\r' as a separator ( considers space, tab, new line ('\n'), and
custom '=' )
- safeValue=$(echo "$value" | tr -d '\r')
case "$key" in wrapperUrl)
- wrapperUrl="$safeValue"
+ wrapperUrl=$(trim "${value-}")
break
;;
esac
@@ -276,7 +282,7 @@ fi
wrapperSha256Sum=""
while IFS="=" read -r key value; do
case "$key" in wrapperSha256Sum)
- wrapperSha256Sum=$value
+ wrapperSha256Sum=$(trim "${value-}")
break
;;
esac