This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new 695388c37a Revert "Improved: no functional change in
ControlFilterTests class"
695388c37a is described below
commit 695388c37afee45923b0afe83504c84b0ce39d8d
Author: Jacques Le Roux <[email protected]>
AuthorDate: Wed Jun 3 12:21:47 2026 +0200
Revert "Improved: no functional change in ControlFilterTests class"
This reverts commit 937097048b0c444147a69ae82b69c5f6c7bfddcc.
Reverts no wanted changes due to Windows use.
I'll re-commit the only wanted changes in ControlFilterTests.java
---
.gitignore | 1 +
framework/security/config/security.properties | 4 +-
.../ofbiz/webapp/control/ControlFilterTests.java | 24 ++-
gradle/init-gradle-wrapper.ps1 | 104 +++++++++--
gradle/init-gradle-wrapper.sh | 203 ++++++++++++++-------
gradle/wrapper/gradle-wrapper.jar | Bin 61574 -> 0 bytes
gradle/wrapper/gradle-wrapper.properties | 3 +-
gradlew | 37 ++--
gradlew.bat | 26 +--
init-gradle-wrapper.bat | 7 +-
10 files changed, 286 insertions(+), 123 deletions(-)
diff --git a/.gitignore b/.gitignore
index c6853dbc44..8693c5d3bb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
bin/
build/
+gradle/wrapper/gradle-wrapper.jar
applications/*/build
framework/*/build
/plugins/
diff --git a/framework/security/config/security.properties
b/framework/security/config/security.properties
index 32cc5c2b01..088a4399b4 100644
--- a/framework/security/config/security.properties
+++ b/framework/security/config/security.properties
@@ -145,7 +145,7 @@ security.login.externalLoginKey.enabled=true
# Read Passwords and JWT (JSON Web Tokens) usage documentation to choose
the way you want to store this key
# The key must be 512 bits (ie 64 chars) as we use HMAC512 to create the
token, cf. OFBIZ-12724
# Run './gradlew generateSecretKeys' to generate a cryptographically secure
random key.
-login.secret_key_string=5CmG8aolQ8zOkrjuMR2vL+FSXnIbVLqQtl8Z1I6Tyl5hUIJ7t02iAFuZ3raQjT1e
+login.secret_key_string=
# -- Time To Live of the token send to the external server in seconds
security.jwt.token.expireTime=1800
@@ -161,7 +161,7 @@ security.internal.sso.enabled=false
# Read Passwords and JWT (JSON Web Tokens) usage documentation to choose
the way you want to store this key
# The key must be 512 bits (ie 64 chars) as we use HMAC512 to create the
token, cf. OFBIZ-12724
# Run './gradlew generateSecretKeys' to generate a cryptographically secure
random key.
-security.token.key=bNssBNUJZvIXAF7GHIjVL5k7ydQ4qB/HxtkLqNCG3kyTpbfpA/wi5AEabuBuWXJZ
+security.token.key=
# -- Specifies the expected issuer (the "iss" claim) of JSON Web Tokens (JWTs).
# If this property is set, the system assumes that tokens are issued and
signed by an external
diff --git
a/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/ControlFilterTests.java
b/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/ControlFilterTests.java
index baae0b4636..e1e6ce2fde 100644
---
a/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/ControlFilterTests.java
+++
b/framework/webapp/src/test/java/org/apache/ofbiz/webapp/control/ControlFilterTests.java
@@ -24,7 +24,6 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -54,18 +53,12 @@ public final class ControlFilterTests {
when(req.getContextPath()).thenReturn("");
resp = mock(HttpServletResponse.class);
next = mock(FilterChain.class);
- System.setProperty("ControlFilterTests",
"bypassPreventsStreamExploitation");
filter = new ControlFilter();
-
- }
-
- @AfterEach
- public void tearDown() {
- System.clearProperty("ControlFilterTests");
}
@Test
public void filterWithExactAllowedPath() throws Exception {
+ System.setProperty("ControlFilterTests",
"bypassPreventsStreamExploitation");
when(config.getInitParameter("redirectPath")).thenReturn("/foo");
when(config.getInitParameter("allowedPaths")).thenReturn("/foo:/bar");
when(req.getRequestURI()).thenReturn("/servlet/bar");
@@ -74,10 +67,12 @@ public final class ControlFilterTests {
filter.init(config);
filter.doFilter(req, resp, next);
verify(next).doFilter(req, resp);
+ System.clearProperty("ControlFilterTests");
}
@Test
public void filterWithAllowedSubPath() throws Exception {
+ System.setProperty("ControlFilterTests",
"bypassPreventsStreamExploitation");
when(config.getInitParameter("redirectPath")).thenReturn("/foo");
when(config.getInitParameter("allowedPaths")).thenReturn("/foo:/bar");
when(req.getRequestURI()).thenReturn("/servlet/bar/baz");
@@ -86,10 +81,12 @@ public final class ControlFilterTests {
filter.init(config);
filter.doFilter(req, resp, next);
verify(next).doFilter(req, resp);
+ System.clearProperty("ControlFilterTests");
}
@Test
public void filterWithRedirection() throws Exception {
+ System.setProperty("ControlFilterTests",
"bypassPreventsStreamExploitation");
when(config.getInitParameter("redirectPath")).thenReturn("/foo");
when(config.getInitParameter("allowedPaths")).thenReturn("/bar:/baz");
when(req.getRequestURI()).thenReturn("/missing/path");
@@ -97,10 +94,12 @@ public final class ControlFilterTests {
filter.init(config);
filter.doFilter(req, resp, next);
verify(resp).sendRedirect("/foo");
+ System.clearProperty("ControlFilterTests");
}
@Test
public void filterWithURIredirection() throws Exception {
+ System.setProperty("ControlFilterTests",
"bypassPreventsStreamExploitation");
when(config.getInitParameter("redirectPath")).thenReturn("http://example.org/foo");
when(config.getInitParameter("allowedPaths")).thenReturn("/foo:/bar");
when(req.getRequestURI()).thenReturn("/baz");
@@ -108,10 +107,12 @@ public final class ControlFilterTests {
filter.init(config);
filter.doFilter(req, resp, next);
verify(resp).sendRedirect("http://example.org/foo");
+ System.clearProperty("ControlFilterTests");
}
@Test
public void bailsOutWithVariousErrorCodes() throws Exception {
+ System.setProperty("ControlFilterTests",
"bypassPreventsStreamExploitation");
when(config.getInitParameter("allowedPaths")).thenReturn("/foo");
when(req.getRequestURI()).thenReturn("/baz");
@@ -137,10 +138,12 @@ public final class ControlFilterTests {
filter.init(config);
filter.doFilter(req, resp, next);
verify(resp).sendError(404, "/baz");
+ System.clearProperty("ControlFilterTests");
}
@Test
public void redirectAllAllowed() throws Exception {
+ System.setProperty("ControlFilterTests",
"bypassPreventsStreamExploitation");
when(config.getInitParameter("redirectPath")).thenReturn("/bar");
when(config.getInitParameter("forceRedirectAll")).thenReturn("Y");
when(config.getInitParameter("allowedPaths")).thenReturn("/foo");
@@ -149,10 +152,12 @@ public final class ControlFilterTests {
filter.init(config);
filter.doFilter(req, resp, next);
verify(resp).sendRedirect("/bar");
+ System.clearProperty("ControlFilterTests");
}
@Test
public void redirectAllNotAllowed() throws Exception {
+ System.setProperty("ControlFilterTests",
"bypassPreventsStreamExploitation");
when(config.getInitParameter("redirectPath")).thenReturn("/bar");
when(config.getInitParameter("forceRedirectAll")).thenReturn("Y");
when(config.getInitParameter("allowedPaths")).thenReturn("/foo");
@@ -161,10 +166,12 @@ public final class ControlFilterTests {
filter.init(config);
filter.doFilter(req, resp, next);
verify(resp).sendRedirect("/bar");
+ System.clearProperty("ControlFilterTests");
}
@Test
public void redirectAllRecursive() throws Exception {
+ System.setProperty("ControlFilterTests",
"bypassPreventsStreamExploitation");
when(config.getInitParameter("redirectPath")).thenReturn("/foo");
when(config.getInitParameter("forceRedirectAll")).thenReturn("Y");
when(config.getInitParameter("allowedPaths")).thenReturn("/foo");
@@ -182,5 +189,6 @@ public final class ControlFilterTests {
filter.doFilter(req, resp, next);
verify(next).doFilter(req, resp);
verify(session).removeAttribute("_FORCE_REDIRECT_");
+ System.clearProperty("ControlFilterTests");
}
}
diff --git a/gradle/init-gradle-wrapper.ps1 b/gradle/init-gradle-wrapper.ps1
index 36d46eb624..9216ab0feb 100644
--- a/gradle/init-gradle-wrapper.ps1
+++ b/gradle/init-gradle-wrapper.ps1
@@ -15,26 +15,106 @@
# specific language governing permissions and limitations
# under the License.
+param(
+ [switch]$Help,
+ [switch]$Upgrade
+)
+
+if ($Help) {
+ Write-Host "Usage: gradle\init-gradle-wrapper.ps1 [-Help] [-Upgrade]"
+ Write-Host ""
+ Write-Host "Downloads and verifies gradle-wrapper.jar for Apache OFBiz."
+ Write-Host "The jar is not committed to the repository; run this script"
+ Write-Host "before using gradlew.bat for the first time."
+ Write-Host ""
+ Write-Host "Options:"
+ Write-Host " -Help Show this message and exit."
+ Write-Host " -Upgrade After downloading/verifying the jar, run"
+ Write-Host " '.\gradlew wrapper' to regenerate gradlew.bat"
+ Write-Host " to match the new Gradle version."
+ Write-Host ""
+ Write-Host "Workflow for Gradle version upgrades (e.g. from a Dependabot
PR):"
+ Write-Host " 1. gradle\init-gradle-wrapper.ps1 -Upgrade"
+ Write-Host " 2. Commit any changes to gradlew and gradlew.bat"
+ exit 0
+}
+
md -force gradle/wrapper
-# download raw format from
https://github.com/gradle/gradle/tree/v7.6.0/gradle/wrapper
+# Parse the Gradle version from gradle-wrapper.properties
+$distributionUrl = (Get-Content "gradle\wrapper\gradle-wrapper.properties" |
Where-Object { $_ -match "^distributionUrl=" }) -replace "^distributionUrl=", ""
+$release = [regex]::Match($distributionUrl,
'gradle-(\d+(?:\.\d+)+)-').Groups[1].Value
+Write-Host "Gradle version: $release"
+
+$gradleWrapperJar = "gradle\wrapper\gradle-wrapper.jar"
+$gradleWrapperUri =
"https://github.com/gradle/gradle/raw/v$release/gradle/wrapper/gradle-wrapper.jar"
+$gradleWrapperSha256Uri =
"https://services.gradle.org/distributions/gradle-$release-wrapper.jar.sha256"
+
+function Get-ExpectedSha256 {
+ try {
+ return Invoke-RestMethod -Uri $gradleWrapperSha256Uri -ErrorAction Stop
+ } catch {
+ return $null
+ }
+}
+
+function Get-ActualSha256 {
+ return (Get-FileHash $gradleWrapperJar -Algorithm SHA256).Hash.ToLower()
+}
+
+# If gradle-wrapper.jar already exists, verify its checksum before deciding to
skip or re-download
+if (Test-Path $gradleWrapperJar) {
+ Write-Host "gradle-wrapper.jar found, verifying checksum..."
+ $expected = Get-ExpectedSha256
+ if ($null -eq $expected) {
+ Write-Host "Warning: could not reach checksum service, skipping
verification"
+ exit 0
+ }
+ $actual = Get-ActualSha256
+ if ($actual -eq $expected) {
+ Write-Host "Checksum OK."
+ if ($Upgrade) {
+ Write-Host "Running '.\gradlew wrapper' to regenerate gradlew and
gradlew.bat..."
+ & .\gradlew wrapper
+ }
+ exit 0
+ } else {
+ Write-Host "Checksum mismatch, re-downloading..."
+ Remove-Item $gradleWrapperJar
+ }
+}
+
+# Download gradle-wrapper.jar from the Gradle GitHub repository
If ($ExecutionContext.SessionState.LanguageMode -eq "ConstrainedLanguage") {
Set-ItemProperty 'hklm:\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment' -name "__PSLockdownPolicy" -Value 8
- Invoke-WebRequest -outf gradle\wrapper\gradle-wrapper.jar
https://github.com/gradle/gradle/raw/v7.6.0/gradle/wrapper/gradle-wrapper.jar
+ Invoke-WebRequest -outf $gradleWrapperJar $gradleWrapperUri
Set-ItemProperty 'hklm:\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment' -name "__PSLockdownPolicy" -Value 4
} else {
- Invoke-WebRequest -outf gradle\wrapper\gradle-wrapper.jar
https://github.com/gradle/gradle/raw/v7.6.0/gradle/wrapper/gradle-wrapper.jar
+ Invoke-WebRequest -outf $gradleWrapperJar $gradleWrapperUri
}
-#
https://docs.gradle.org/current/userguide/gradle_wrapper.html#wrapper_checksum_verification
-$expected = Invoke-RestMethod -Uri
https://services.gradle.org/distributions/gradle-7.6-wrapper.jar.sha256
-$actual = (Get-FileHash gradle\wrapper\gradle-wrapper.jar -Algorithm
SHA256).Hash.ToLower()
-@{$true = 'OK: Checksum match'; $false = "ERROR: Checksum mismatch!`nExpected:
$expected`nActual: $actual"}[$actual -eq $expected]
-
-if (!$true) {
- Remove-Item gradle\wrapper\gradle-wrapper.jar
+# Verify the downloaded jar against the expected checksum published by Gradle
+# See:
https://docs.gradle.org/current/userguide/gradle_wrapper.html#wrapper_checksum_verification
+Write-Host "Verifying checksum..."
+$expected = Get-ExpectedSha256
+if ($null -eq $expected) {
+ Remove-Item $gradleWrapperJar
+ Write-Host "Error: could not fetch checksum from $gradleWrapperSha256Uri"
+ exit 1
+}
+$actual = Get-ActualSha256
+if ($actual -eq $expected) {
+ Write-Host "Checksum OK."
+ if ($Upgrade) {
+ Write-Host "Running '.\gradlew wrapper' to regenerate gradlew and
gradlew.bat..."
+ & .\gradlew wrapper
+ }
+} else {
+ Remove-Item $gradleWrapperJar
+ Write-Host "Error: checksum mismatch"
+ Write-Host "Expected: $expected"
+ Write-Host "Actual: $actual"
+ exit 1
}
-
-#Write-Host $ExecutionContext.SessionState.LanguageMode
Start-Sleep -s 3
diff --git a/gradle/init-gradle-wrapper.sh b/gradle/init-gradle-wrapper.sh
index 764b40605a..aed0b50726 100755
--- a/gradle/init-gradle-wrapper.sh
+++ b/gradle/init-gradle-wrapper.sh
@@ -16,93 +16,162 @@
# specific language governing permissions and limitations
# under the License.
-# Variable for location
+# Paths
OFBIZ_HOME="$(pwd)"
-GRADLE_OFBIZ_PATH="$OFBIZ_HOME/gradle"
-GRADLE_WRAPPER_OFBIZ_PATH="$GRADLE_OFBIZ_PATH/wrapper"
-
-# version and uri to download the wrapper
-RELEASE="6.5.1"
-GRADLE_WRAPPER_URI="https://github.com/gradle/gradle/raw/v$RELEASE/gradle/wrapper/"
-
-# checksum to verify the downloaded file
-SHASUM_GRADLE_WRAPPER_FILES="33b0acb4572934fc1dd7d5880c65036724974e06
gradle/wrapper/gradle-wrapper.jar
-b76cfc82d574180f435b4bd9d4b0f29a3c32294b
gradle/wrapper/gradle-wrapper.properties
-67bc176bca816684cf5218570a931f57d5f2b423 gradlew"
-
-GRADLE_WRAPPER_JAR="gradle-wrapper.jar"
-GRADLE_WRAPPER_PROPERTIES="gradle-wrapper.properties"
-GRADLE_WRAPPER_FILES="$GRADLE_WRAPPER_JAR $GRADLE_WRAPPER_PROPERTIES"
-GRADLE_WRAPPER_SCRIPT="gradlew"
+GRADLE_WRAPPER_OFBIZ_PATH="$OFBIZ_HOME/gradle/wrapper"
+GRADLE_WRAPPER_PROPERTIES="$GRADLE_WRAPPER_OFBIZ_PATH/gradle-wrapper.properties"
+GRADLE_WRAPPER_JAR="$GRADLE_WRAPPER_OFBIZ_PATH/gradle-wrapper.jar"
whereIsBinary() {
whereis $1 | grep /
}
-# Perform the download using curl or wget
+# Perform the download using curl or wget, output to stdout
+downloadToStdout() {
+ if [ -n "$(whereIsBinary curl)" ]; then
+ curl -L -s "$1"
+ elif [ -n "$(whereIsBinary wget)" ]; then
+ wget -q -O - "$1"
+ fi
+}
+
+# Download a file to a given destination path
downloadFile() {
- if [ -n "$(whereIsBinary curl)" ]; then
- GET_CMD="curl -L -o $GRADLE_WRAPPER_OFBIZ_PATH/$1 -s -w %{http_code}
$2/$1";
- if [ "$($GET_CMD)" = "200" ]; then
- return 0;
- fi
- elif [ -n "$(whereIsBinary wget)" ]; then
- if [[ `wget -q -S -O $GRADLE_WRAPPER_OFBIZ_PATH/$1 $2/$1 2>&1 >
/dev/null | grep 'HTTP/1.1 200 OK'` ]]; then
- return 0;
- fi
- fi
- return 1
+ if [ -n "$(whereIsBinary curl)" ]; then
+ HTTP_CODE=$(curl -L -o "$2" -s -w '%{http_code}' "$1")
+ [ "$HTTP_CODE" = "200" ]
+ elif [ -n "$(whereIsBinary wget)" ]; then
+ wget -q -O "$2" "$1" 2>&1 | grep -q 'HTTP/1.1 200 OK'
+ [ $? -eq 0 ]
+ else
+ return 1
+ fi
}
-# Download the file from the main URI
-resolveFile() {
- downloadFile $1 $GRADLE_WRAPPER_URI;
+# Compute SHA256 of a file
+computeSha256() {
+ if [ -n "$(whereIsBinary sha256sum)" ]; then
+ sha256sum "$1" | cut -d' ' -f1
+ elif [ -n "$(whereIsBinary shasum)" ]; then
+ shasum -a 256 "$1" | cut -d' ' -f1
+ fi
}
-echo " === Prepare operation ===";
+UPGRADE=false
+
+for arg in "$@"; do
+ case "$arg" in
+ --help)
+ echo "Usage: sh gradle/init-gradle-wrapper.sh [--help] [--upgrade]"
+ echo ""
+ echo "Downloads and verifies gradle-wrapper.jar for Apache OFBiz."
+ echo "The jar is not committed to the repository; run this script"
+ echo "before using ./gradlew for the first time."
+ echo ""
+ echo "Options:"
+ echo " --help Show this message and exit."
+ echo " --upgrade After downloading/verifying the jar, run"
+ echo " './gradlew wrapper' to regenerate gradlew and"
+ echo " gradlew.bat to match the new Gradle version."
+ echo ""
+ echo "Workflow for Gradle version upgrades (e.g. from a Dependabot
PR):"
+ echo " 1. sh gradle/init-gradle-wrapper.sh --upgrade"
+ echo " 2. Commit any changes to gradlew and gradlew.bat"
+ exit 0
+ ;;
+ --upgrade)
+ UPGRADE=true
+ ;;
+ *)
+ echo "Unknown option: $arg"
+ echo "Run 'sh gradle/init-gradle-wrapper.sh --help' for usage."
+ exit 1
+ ;;
+ esac
+done
+
# Verify that the script is executed from the right location
-if [ ! -d "$GRADLE_OFBIZ_PATH" ]; then
- echo "Location seems to be incorrect, please run 'sh
gradle/init-gradle-wrapper.sh' from the Apache OFBiz home";
- exit 1;
+if [ ! -f "$GRADLE_WRAPPER_PROPERTIES" ]; then
+ echo "gradle/wrapper/gradle-wrapper.properties not found."
+ echo "Please run 'sh gradle/init-gradle-wrapper.sh' from the Apache OFBiz
home."
+ exit 1
+fi
+
+# Parse the Gradle version from gradle-wrapper.properties
+RELEASE=$(grep "^distributionUrl=" "$GRADLE_WRAPPER_PROPERTIES" | sed
's/.*gradle-\([0-9.]*\)-.*/\1/')
+if [ -z "$RELEASE" ]; then
+ echo "Could not determine Gradle version from $GRADLE_WRAPPER_PROPERTIES"
+ exit 1
fi
-if [ ! -d "$GRADLE_WRAPPER_OFBIZ_PATH" ]; then
- mkdir $GRADLE_WRAPPER_OFBIZ_PATH;
+echo "Gradle version: $RELEASE"
+
+GRADLE_WRAPPER_URI="https://github.com/gradle/gradle/raw/v$RELEASE/gradle/wrapper/gradle-wrapper.jar"
+GRADLE_WRAPPER_SHA256_URI="https://services.gradle.org/distributions/gradle-$RELEASE-wrapper.jar.sha256"
+
+# If gradle-wrapper.jar already exists, verify its checksum before deciding to
skip or re-download
+if [ -r "$GRADLE_WRAPPER_JAR" ]; then
+ echo "gradle-wrapper.jar found, verifying checksum..."
+ EXPECTED_SHA256=$(downloadToStdout "$GRADLE_WRAPPER_SHA256_URI")
+ if [ -z "$EXPECTED_SHA256" ]; then
+ echo "Warning: could not reach checksum service, skipping verification"
+ exit 0
+ fi
+ ACTUAL_SHA256=$(computeSha256 "$GRADLE_WRAPPER_JAR")
+ if [ -z "$ACTUAL_SHA256" ]; then
+ echo "Warning: sha256sum or shasum not found, cannot verify existing
gradle-wrapper.jar"
+ exit 0
+ fi
+ if [ "$ACTUAL_SHA256" = "$EXPECTED_SHA256" ]; then
+ echo "Checksum OK."
+ if [ "$UPGRADE" = true ]; then
+ echo "Running './gradlew wrapper' to regenerate gradlew and
gradlew.bat..."
+ ./gradlew wrapper
+ fi
+ exit 0
+ else
+ echo "Checksum mismatch, re-downloading..."
+ rm -f "$GRADLE_WRAPPER_JAR"
+ fi
fi
-# check if we have on binary to download missing wrapper
+# Ensure curl or wget is available
if [ -z "$(whereIsBinary curl)" ] && [ -z "$(whereIsBinary wget)" ]; then
- echo "curl or wget not found, please install one of them or install
yourself gradle (for more information see README.md or
https://gradle.org/install)";
- exit 1
+ echo "curl or wget not found, please install one of them or install
yourself gradle (for more information see README.md or
https://gradle.org/install)"
+ exit 1
fi
-if [ ! -r "$GRADLE_WRAPPER_OFBIZ_PATH/$GRADLE_WRAPPER_JAR" ]; then
- echo "$GRADLE_WRAPPER_OFBIZ_PATH/$GRADLE_WRAPPER_JAR not found, we
download it"
+echo "Downloading gradle-wrapper.jar..."
+if ! downloadFile "$GRADLE_WRAPPER_URI" "$GRADLE_WRAPPER_JAR"; then
+ rm -f "$GRADLE_WRAPPER_JAR"
+ echo "Download of gradle-wrapper.jar from $GRADLE_WRAPPER_URI failed."
+ echo "Please check the logs, fix the problem and run the script again."
+ exit 1
+fi
- for fileToDownload in $GRADLE_WRAPPER_FILES; do
- echo " === Download $fileToDownload ===";
- resolveFile $fileToDownload
- done
- if [ ! $? -eq 0 ]; then
- rm -f $GRADLE_WRAPPER_OFBIZ_PATH/*
- echo "\nDownload files $GRADLE_WRAPPER_FILES from $GRADLE_WRAPPER_URI
failed.\nPlease check the logs, fix the problem and run the script again."
- fi
+echo "Verifying checksum..."
+EXPECTED_SHA256=$(downloadToStdout "$GRADLE_WRAPPER_SHA256_URI")
+if [ -z "$EXPECTED_SHA256" ]; then
+ rm -f "$GRADLE_WRAPPER_JAR"
+ echo "Error: could not fetch checksum from $GRADLE_WRAPPER_SHA256_URI"
+ exit 1
+fi
- if [ ! -r "$GRADLE_WRAPPER_SCRIPT" ]; then
- echo " === Download script wrapper ==="
- resolveFile $GRADLE_WRAPPER_SCRIPT
- mv "$GRADLE_WRAPPER_OFBIZ_PATH/$GRADLE_WRAPPER_SCRIPT" .
- chmod u+x $GRADLE_WRAPPER_SCRIPT
- fi
+ACTUAL_SHA256=$(computeSha256 "$GRADLE_WRAPPER_JAR")
+if [ -z "$ACTUAL_SHA256" ]; then
+ echo "Warning: sha256sum or shasum not found, the downloaded file could
not be verified"
+ exit 0
+fi
- echo " === Control downloaded files ==="
- if [ -n "$(whereIsBinary shasum)" ]; then
- echo "$SHASUM_GRADLE_WRAPPER_FILES" | shasum -c -;
- echo " Warning: shasum not found, the downloaded files could not be
verified"
- exit 0;
- else
- exit 1;
- fi
+if [ "$ACTUAL_SHA256" = "$EXPECTED_SHA256" ]; then
+ echo "Checksum OK."
+ if [ "$UPGRADE" = true ]; then
+ echo "Running './gradlew wrapper' to regenerate gradlew and
gradlew.bat..."
+ ./gradlew wrapper
fi
- exit 1;
+else
+ rm -f "$GRADLE_WRAPPER_JAR"
+ echo "Error: checksum mismatch"
+ echo "Expected: $EXPECTED_SHA256"
+ echo "Actual: $ACTUAL_SHA256"
+ exit 1
fi
-echo " Nothing more to be done"
diff --git a/gradle/wrapper/gradle-wrapper.jar
b/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 943f0cbfa7..0000000000
Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/gradle/wrapper/gradle-wrapper.properties
b/gradle/wrapper/gradle-wrapper.properties
index 2617362fd0..4f5eb9dcc0 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.5-bin.zip
networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 65dcd68d65..23d15a9367 100755
--- a/gradlew
+++ b/gradlew
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
-#
https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+#
https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -83,10 +85,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to
pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+# Discard cd standard output in case $CDPATH is set
(https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) ||
exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@@ -133,10 +133,13 @@ location of your Java installation."
fi
else
JAVACMD=java
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no
'java' command could be found in your PATH.
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found
in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
+ fi
fi
# Increase the maximum file descriptors if we can.
@@ -144,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is
checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -152,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is
checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -197,16 +200,20 @@ if "$cygwin" || "$msys" ; then
done
fi
-# Collect all arguments for the java command;
-# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
-# shell script including quotes and variable substitutions, so put them in
-# double quotes to make sure that they get re-expanded; and
-# * put everything else in single quotes, so that it's not re-expanded.
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to
pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to
contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is
an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
- org.gradle.wrapper.GradleWrapperMain \
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
diff --git a/gradlew.bat b/gradlew.bat
index 93e3f59f13..db3a6ac207 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your
PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your
PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
@@ -57,22 +59,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+set CLASSPATH=
@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS%
"-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%"
org.gradle.wrapper.GradleWrapperMain %*
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS%
"-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar
"%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
diff --git a/init-gradle-wrapper.bat b/init-gradle-wrapper.bat
index 5e38fa2e84..fe5ba52792 100755
--- a/init-gradle-wrapper.bat
+++ b/init-gradle-wrapper.bat
@@ -18,9 +18,4 @@ rem specific language governing permissions and limitations
rem under the License.
rem #####################################################################
-if exist "%~dp0gradle\wrapper\gradle-wrapper.jar" (
- echo The Gradle Wrapper has already been downloaded.
- exit /b
-)
-
-pwsh -command " Start-Process pwsh -Verb RunAs \""-Command `\""cd '%cd%'; &
'gradle\init-gradle-wrapper.ps1';`\""\"" "
+pwsh -command " Start-Process pwsh -Verb RunAs \""-Command `\""cd '%cd%'; &
'gradle\init-gradle-wrapper.ps1' %*;`\""\"" "