Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
KnowageLabs
Knowage-Server
Commits
71bdcd1f
Commit
71bdcd1f
authored
May 27, 2022
by
Marco Libanori
Browse files
[KNOWAGE-6790] Correctly manage escapes in LOV execution
parent
5efbc138
Changes
1
Hide whitespace changes
Inline
Side-by-side
knowageutils/src/main/java/it/eng/spagobi/commons/utilities/StringUtilities.java
View file @
71bdcd1f
...
...
@@ -266,7 +266,7 @@ public class StringUtilities {
if
(
slashEIndex
==
-
1
)
return
"\\Q"
+
s
+
"\\E"
;
StringBu
ff
er
sb
=
new
StringBu
ff
er
(
s
.
length
()
*
2
);
StringBu
ild
er
sb
=
new
StringBu
ild
er
(
s
.
length
()
*
2
);
sb
.
append
(
"\\Q"
);
slashEIndex
=
0
;
int
current
=
0
;
...
...
@@ -463,6 +463,8 @@ public class StringUtilities {
replacement
=
"'"
+
replacement
;
if
(!
replacement
.
endsWith
(
"'"
))
replacement
=
replacement
+
"'"
;
replacement
=
escapeInternalQuotes
(
replacement
);
}
attribute
=
quote
(
attribute
);
...
...
@@ -475,6 +477,14 @@ public class StringUtilities {
}
private
static
String
escapeInternalQuotes
(
String
replacement
)
{
return
new
StringBuilder
()
.
append
(
replacement
.
charAt
(
0
))
.
append
(
replacement
.
substring
(
1
,
replacement
.
length
()
-
1
).
replaceAll
(
"'"
,
"''"
))
.
append
(
replacement
.
charAt
(
replacement
.
length
()
-
1
))
.
toString
();
}
/**
* Substitutes parameters with sintax "$P{parameter_name}" whose value is set in the map. This is only for dataset, had to duplicate to handle null values,
* in case ogf null does not throw an exception but substitute null!
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment