add parameter check for grape define

Signed-off-by: 王歌 <wang__ge@126.com>
(cherry picked from commit e41489bdfb4f0ae0f82d5f4cc9479a6c94febf09)
This commit is contained in:
wang--ge 2024-03-13 18:01:02 +08:00 committed by openeuler-sync-bot
parent bb6d27301b
commit 36c4371075
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,39 @@
From 696538030dcf6ba670cb1dd8f9d762d860aac01c Mon Sep 17 00:00:00 2001
From: wang--ge <wang__ge@126.com>
Date: Thu, 14 Mar 2024 11:19:28 +0800
Subject: [PATCH] asd
---
.../org/codehaus/groovy/tools/GrapeMain.groovy | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/main/org/codehaus/groovy/tools/GrapeMain.groovy b/src/main/org/codehaus/groovy/tools/GrapeMain.groovy
index 0a1843d..528e8ed 100644
--- a/src/main/org/codehaus/groovy/tools/GrapeMain.groovy
+++ b/src/main/org/codehaus/groovy/tools/GrapeMain.groovy
@@ -348,10 +348,18 @@ if (cmd.hasOption('v')) {
return
}
-
-cmd.getOptionValues('D')?.each {String prop ->
- def (k, v) = prop.split ('=', 2) as List // array multiple assignment quirk
- System.setProperty(k, v ?: "")
+if (cmd.hasOption('D')) {
+ cmd.getOptionValues('D')?.each {String prop ->
+ while (prop.startsWith("=")) {
+ prop = prop.substring(1, prop.length());
+ }
+ def (k, v) = prop.split ('=', 2) as List // array multiple assignment quirk
+ if (k.isEmpty() || v.isEmpty()) {
+ println "one system property's name or value is emply, skip."
+ } else {
+ System.setProperty(k, v ?: "")
+ }
+ }
}
String[] arg = cmd.args
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: groovy Name: groovy
Version: 2.4.8 Version: 2.4.8
Release: 12 Release: 13
Summary: Dynamic language for the Java Platform Summary: Dynamic language for the Java Platform
License: ASL 2.0 and BSD and EPL-1.0 and Public Domain and ANTLR-PD and MIT License: ASL 2.0 and BSD and EPL-1.0 and Public Domain and ANTLR-PD and MIT
URL: http://groovy-lang.org URL: http://groovy-lang.org
@ -20,6 +20,7 @@ Patch6: 0007-Fix-missing-extension-definitions.patch
Patch7: CVE-2020-17521.patch Patch7: CVE-2020-17521.patch
Patch8: Speed-up-class-loading-of-groovy-all-files.patch Patch8: Speed-up-class-loading-of-groovy-all-files.patch
Patch9: 0008-compatible-for-version-1.8.patch Patch9: 0008-compatible-for-version-1.8.patch
Patch10: 0009-add-parameter-check-for-grape-define.patch
BuildRequires: gradle-local >= 2.1-0.9 javapackages-local java-devel >= 1.8 ant antlr-tool ant-antlr BuildRequires: gradle-local >= 2.1-0.9 javapackages-local java-devel >= 1.8 ant antlr-tool ant-antlr
BuildRequires: aqute-bnd gpars multiverse apache-parent testng jline apache-commons-cli apache-commons-beanutils BuildRequires: aqute-bnd gpars multiverse apache-parent testng jline apache-commons-cli apache-commons-beanutils
@ -192,6 +193,9 @@ EOF
%doc LICENSE NOTICE README.adoc %doc LICENSE NOTICE README.adoc
%changelog %changelog
* Wed Mar 13 2024 Ge Wang <wang__ge@126.com> - 2.4.8-13
- Add parameter check for grape define
* Tue Feb 20 2024 Ge Wang <wang__ge@126.com> - 2.4.8-12 * Tue Feb 20 2024 Ge Wang <wang__ge@126.com> - 2.4.8-12
- Compatible adapter for version 1.8 - Compatible adapter for version 1.8